1 of 1 people found this helpful
Regarding improvement suggestion for KBA210620:
It might be worth mentioning that some psoc usb examples have the potential to get hung
if the unplug event occurs at a special time.
so that the VBUS monitoring stuff in the main loop can not do its work anymore.
e.g. code lines like:
KBA210620 should give advices (or links) for this problem also:
- like calming a watchdog only in the VBUS monitoring section
- doing VBUS monitoring in a periodic ISR
- hints how to avoid potential endless llops
My preliminary approach
static unsigned int count = 0;
if(count > 50)
count = 0;
if (!USBFS_VBusPresent() && usbEnumerated)