Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

USB CDC ACM float support / corrupted messages

Hello,

I'm using sprintf to prepare a string to be sent with app_usbd_cdc_acm_write() with a usb configuration resembling your usbd_cdc_acm example of SDK 17.0.2.

When floating point support for printf (&sprintf) is enabled in SES, the message appearing on the virtual com port on a windows machine is unreadable.

Is this expected behaviour? It took me quite a while to figure this out and I havent found anything in the documentation in this regard.

Please let me know if there is a workaround, as I want to use floating point support in printf.

Thank you

(nRF52840, SDK 17.0.2, SES R 5.30)

Edit: To clarify: As long as float support is enabled, pp_usbd_cdc_acm_write() will only transmit corrupted messages, regardless of actual floating point content. Shouldnt even matter as it only receives a pointer to a char array and the floating point printing is handled by sprintf, which is working just fine by itself.

Edit2: Now it just works. Have not changed anything and I'm even more clueless why that happened, as it was repeatable many times before. So probably an issue of the terminal application in windows.

Parents Reply
  • Hello Jørgen, this is very much possible. Do you by chance know if there is an example use case of a fifo or ring buffer to avoid overwriting cdc acm transfers? If I understand it correctly the usbd class uses some form of fifo, but not the cdc acm implementation.  I think it is a bit challenging to use for the lesser experienced developers.

    Thank you for your answer, I will mark this as solved

Children
No Data
Related