реклама на сайте
подробности

 
 
 
Reply to this topicStart new topic
> Отладка USB устройства, на плате, Как правильно запустить?
MCZ
сообщение Oct 11 2010, 18:46
Сообщение #1


Участник
*

Группа: Участник
Сообщений: 17
Регистрация: 3-03-09
Пользователь №: 45 596



Подскажите, плиз:

Есть evaluation Board, на нем HC908-JB16.

Работает под USB, на плате реализован монитор через RS232.

Прошивку лью через ICP.

Пытаюсь отладиться через дебаг монитр MON08, питание взято от того же USB,

В обычном режиме устройство детектится нормально, драйвер становится и т.п.
А при подключении через дебаг монитор, стартую прошивку, но коммуникации с портом USB на компьютере не происходит.
При включении компьютер видит устройство с нулевыми дескрипторми, и это понятно, ведь запускается сам монитор, а не прошивка.

Т.е. инициализация со стороны компьютера проходит неверно.

Как правильно в режиме отладки стартануть устройство, чтобы компьютер начал взаимодействовать с устройство в обычном режиме,
и можно было бы в отладчике установить брекпоинт на точке входа и дальше уже отладиться.

Со стороны компьютера, устройство первоначально подключается в режиме пустышки, получается, т.е. толко питание берется, а обмена нет. А дальше, при старте прошивки, компьютер уже не ждет обмена от устройства, и соответственно, подвисает устройство.

Есть мысль запитать схему от другого источника, затем войти в режим монитора, установить брекпойин и затем уже воткнуть USB в компьютер, при этом пойдет запрос на инициализацию устройства и должна начать выполняться прошивка внутри, как минимум должен прийти запрос дескриптора. Есть ли какие-то тонкости реализации такого режима отладки или надо купить плату для внутрисхемной отладки нормальную.
спасибо.

Сообщение отредактировал MCZ - Oct 11 2010, 18:50
Go to the top of the page
 
+Quote Post
DmitryM
сообщение Oct 11 2010, 19:13
Сообщение #2


Знающий
****

Группа: Свой
Сообщений: 583
Регистрация: 7-06-06
Из: Таганрог
Пользователь №: 17 840



Цитата(MCZ @ Oct 11 2010, 22:46) *
Подскажите, плиз:

Есть evaluation Board, на нем HC908-JB16.

Работает под USB, на плате реализован монитор через RS232.


А есть возможность передернуть PullUp на линиях USB??? Тем самым Вы скажете ПК заново проинициализировать USB-Device.
Go to the top of the page
 
+Quote Post
MCZ
сообщение Oct 11 2010, 19:52
Сообщение #3


Участник
*

Группа: Участник
Сообщений: 17
Регистрация: 3-03-09
Пользователь №: 45 596



Цитата(DmitryM @ Oct 11 2010, 22:13) *
А есть возможность передернуть PullUp на линиях USB??? Тем самым Вы скажете ПК заново проинициализировать USB-Device.


Могу поставить микрик туда, попробовать:
То бишь мы имитируем ситуация, которая выделена ниже.....

1. The hub (or root hub) where the device is attached informs the host that
an event has occurred. There are two 15K pull down resistors connected to the D+ and D- USB wires in the hub port or root hub in the
host.
When the device is attached, its pull-up resistor (see USB Mechanical and Electrical section) will cause the signal level of either
D+ or D- to rise, thereby signaling the attachment of a USB device.

The device is now considered to be in the attached stage


2. The host inquires the hub regarding the nature of the event.

3. The host issues a "port enable and reset" command to the hub where the device is attached.

4. The hub will then issue a USB reset signal to that port for 10 ms and
provide 100 mA of power supply to the device after the reset signal is
completed. The device now is considered to be in the powered stage,
as shown in Figure 2-14. From the device point of view, the reset signal
is the first signal it sees when it is attached to the hub or root hub. After
the reset signal, the device is in its default stage, where it corresponds
to the host with its default address (address 0 and endpoint 0).

5. The host will then initiate a GET DESCRIPTOR ("device" descriptor
type) setup packet to the device, and the device needs to respond
accordingly.

Цитата(MCZ @ Oct 11 2010, 22:42) *
Могу поставить микрик туда, попробовать:
То бишь мы имитируем ситуация, которая выделена ниже.....

1. The hub (or root hub) where the device is attached informs the host that
an event has occurred. There are two 15K pull down resistors connected to the D+ and D- USB wires in the hub port or root hub in the
host.
When the device is attached, its pull-up resistor (see USB Mechanical and Electrical section) will cause the signal level of either
D+ or D- to rise, thereby signaling the attachment of a USB device.

The device is now considered to be in the attached stage


2. The host inquires the hub regarding the nature of the event.

3. The host issues a "port enable and reset" command to the hub where the device is attached.

4. The hub will then issue a USB reset signal to that port for 10 ms and
provide 100 mA of power supply to the device after the reset signal is
completed. The device now is considered to be in the powered stage,.

From the device point of view, the reset signal
is the first signal it sees when it is attached to the hub or root hub.
After the reset signal, the device is in its default stage, where it corresponds
to the host with its default address (address 0 and endpoint 0).

5. The host will then initiate a GET DESCRIPTOR ("device" descriptor
type) setup packet to the device, and the device needs to respond
accordingly.



Дык, а по 4 пунку, если шина отресетит контроллер, не сбросится ли хардварный брекпоинт при этом?
Монитор не слетает при софтовом ресете, а вот бряк может слететь.

Судя по даташиту,
CODE
The break address registers (BRKH and BRKL) contain the high and low
bytes of the desired breakpoint address. Reset clears the break address
registers.


Сообщение отредактировал MCZ - Oct 11 2010, 20:47
Go to the top of the page
 
+Quote Post
DmitryM
сообщение Oct 12 2010, 03:40
Сообщение #4


Знающий
****

Группа: Свой
Сообщений: 583
Регистрация: 7-06-06
Из: Таганрог
Пользователь №: 17 840



Цитата(MCZ @ Oct 11 2010, 23:52) *
Могу поставить микрик туда, попробовать:
То бишь мы имитируем ситуация, которая выделена ниже.....

4. The hub will then issue a USB reset signal to that port for 10 ms and
provide 100 mA of power supply to the device after the reset signal is
completed. The device now is considered to be in the powered stage,
as shown in Figure 2-14. From the device point of view, the reset signal
is the first signal it sees when it is attached to the hub or root hub. After
the reset signal, the device is in its default stage, where it corresponds
to the host with its default address (address 0 and endpoint 0).


Дык, это команда (Reset) для приведения USB-стайт-машины в исходное состояние. Зачем же Вам сбрасывать весь микроконтроллер.
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
1 чел. читают эту тему (гостей: 1, скрытых пользователей: 0)
Пользователей: 0

 


RSS Текстовая версия Сейчас: 19th July 2025 - 03:58
Рейтинг@Mail.ru


Страница сгенерированна за 0.01384 секунд с 7
ELECTRONIX ©2004-2016