cancel
Showing results for 
Search instead for 
Did you mean: 

iwdg is not working while usb device is running.

Paul.Lee
Associate III

Hi,
My MCU us stm32f401rct6.
This MCU has three UART and all UART are using for service. No console UART port
So, I make a USB CDC device to use console port.
But, iwdg is not working. When I use UART console port, while(1); occur watchdog reset. But, when I use USB CDC for console, while(1); not occur watchdog reset.

Thank you in advanced.
BR
Paul

1 ACCEPTED SOLUTION

Accepted Solutions
Paul.Lee
Associate III

I solve this problem by removing pull-up resister on D+.
Some blog say D+ in stm32f4 has pull-up resister in it.

View solution in original post

6 REPLIES 6
Paul.Lee
Associate III

CDC function is working well except watchdog

TDK
Guru

IWDG is independent of everything. It uses its own clock. Unlikely it's not working due to whatever else you're doing on the chip. Perhaps it didn't get initialized or is being refreshed somewhere else. Recheck your assumptions.

If you feel a post has answered your question, please click "Accept as Solution".

Hi,

I did as follow.

           __disable_irq(); 
          while (1); // reset by watchdog

Disable all interrupt and call just while(1); But, No watchdog reset.
I do not use RTOS.
-----
On the other point, when I try to reset hardware by reset pin.
But after reset, code is not working properly, stuck on usb tx function. after power reset, working well.
software restart function seems be problem.
watchdog reset was working, but restart function seems be problem I think.
Paul.Lee
Associate III

Hi,

I found a reason.
When software restart, USB device is not working properly. I don't know exactly.
In first CDC_Transmit_FS(), watchdog timer is expired.
Because, I call  while (CDC_Transmit_FS((uint8_t*)&c, 1) != USBD_OK); to ensure tx opeation thru USB is completly before next tx.
At this line, watchdog is working. It looks not working my board.
Temporary, I modify this line and test like this.

PaulLee_0-1692675515467.png

And go next step.
When USB cable is disconnect on the go or USB cable is not connected at reboot time, CDC_Transmit_FS((uint8_t*)&c, 1) return FAIL.
How can I detect USB cable is not connected or disconnected.
What is the reason USB can not detect at software restart?

CDC_Transmit_FS((uint8_t*)&c, 1) is not working after software reset.
USB cable remove and connect again, CDC_Transmit_FS((uint8_t*)&c, 1) is wiorking.
I hardware pull-up 1.5K on D+, do I need to add tr on pull-up resister to re-recognize? 

BR
Paul

 

Paul.Lee
Associate III

I solve this problem by removing pull-up resister on D+.
Some blog say D+ in stm32f4 has pull-up resister in it.

You can also use the reference manual for such information rather than relying on random blogs.

If you feel a post has answered your question, please click "Accept as Solution".