c - STM32 STM32CubeF4 USB CDC operation -
i built code stm32cubef4 usb cdc example. added missing receive code cdc_receive_fs() in usbd_cdc_if.c. loaded stm32f4 discovery , works. character typed on tera term returns , displayed on tera term.
i hoping here, give me knowledge how usb cdc firmware works, specifically, being driven interrupt generated when there level shift in voltage on usb -d , +d pins, or there infinite while loop launched somewhere, , it's polling waiting data appear? prompted question see 1 can blink leds on board toggling state of gpio pins within infinite while loop in main.c. however, there nothing within while loop @ within main.c usb. how usb cdc firmware , send character from/to tera term.
i take 2 minutes answer instead of lecturing you. receive done through interrupts. very, simply, hardware sees voltage change on d+/d- , flags interrupt based on intialization functions. interrupt calls hal_pcd_irqhandler, calls usbd_ll_datainstage in usbd_conf.c file. ends calling function usbd_cdc_datain in usbd_cdc.c file. there starting point, not simple. want might have stop output uart , handle in main loop.
Comments
Post a Comment