shingadaddy

USB CDC example - Cube.

Discussion created by shingadaddy on Dec 5, 2016
Latest reply on Dec 8, 2016 by shingadaddy

So what does the HAL CubeL4 USB CDC demo do for you?

Excerpt from Page 7 says:
"The USB device library aim is to provide at least one firmware demonstration per USB transfer type:
• Communication Device (CDC)
VCP USB-to-RS232 bridge to realize a virtual COM port."

So it makes a USB to UART converter.

Pictures in head :
- USB to RS 232 converter. But with Nucleo -  without the voltage converter or 9 pin D connector)

Expectations maybe

- Stuff come in from PC usb
- INTERRUPT!
- Grab and move or point to it and TX from UART (Nacking any other USB stuff for now)
- INTERRUPT! DONE!
OR
- Stuff comes in from UART
- Interrupt
- Grab and move or point to it and TX from USB.
- INTERRUPT! DONE!

And my pictures are blurred.

Manual ITEM 1:
"CDC IN and OUT data transfers are managed by two functions:
– USBD_CDC_SetTxBuffer should be called by user application each time a data
(or a certain number of data) is available to be sent to the USB Host from the
hardware terminal.
– USBD_CDC_SetRxBuffer is called by the CDC core each time a buffer is sent
from the USB Host and should be transmitted to the hardware terminal. This
function should exit only when all data in the buffer are sent (the CDC core then
blocks all coming OUT packets until this function finishes processing the previous
packet)."

Key words to me being "EACH TIME"

Function "USBD_CDC_SetTxBuffer"
Seems to only be present and called in 2 places in project
1. In function static int8_t CDC_Itf_Init(void) [ usbd_cdc_interface.c ]
2. In a TIMER interrupt handler in function void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim)
(A TIMER?)

Function "USBD_CDC_SetRxBuffer"
Seems to only be present and called in 1 places in project
1. In function static int8_t CDC_Itf_Init(void) [ usbd_cdc_interface.c ]


Manual ITEM 2:
Manual UM1734 (DocID025934 Rev 3 - en.DM00108129.pdf) Page 52
1."CDC control requests should be handled by the function Controllability()".
Function "Controllability" not found with SEARCH in demo project.


Problems
1. Missing functions?
2. A TIMER ?   Timer not even mentioned in UM1734
3. No calls to functions based on *receptions*
4. Vtables?

Seems like I've stumbled upon some of that OTG_DAINT OUT Endpoint 3 = Bit 18 stuff.

*Guidance please*

Outcomes