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 Children
  • Hello Nguyen, thank you. But I think that is not the problem I am facing. I know of that flag and SES should set it when setting "Printf Floating Point Supported" to "Float". Besides, I didn't have any issues actually using sprintf to prepare data containing floats, e.g. to be sent via UART. app_usbd_cdc_acm_write() will just not work regardless if the buffer to send contains floats or not, as long as floating point support is enabled

Related