Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs

app_usbd_cdc_acm_write() is not responding from another cpp file

Hi,

For my nRF52840 custom board, when I send data through app_usbd_cdc_acm_write() to the serial port from main.c ,  data are transferred without problem but

when I try to send data from another .c file in my project,  through app_usbd_cdc_acm_write(),  the data never reach the serial terminal.

The steps that I have taken so far are the following

I created a pointer to the usbd instance I use in main.c

app_usbd_cdc_acm_t * p_usbd_instance = &m_app_cdc_acm;

and then I used that pointer in the .c file I want to call the app_usbd_cdc_acm_write().

I also included the following library for the USB communication

#include "app_usbd_cdc_acm.h"     

//..
//..

extern app_usbd_cdc_acm_t * p_usbd_instance;

But when I call app_usbd_cdc_acm_write() in that .c file by sending the following test string,

the serial terminal gets nothing from the custom board

if(usbd_rx_complete == true)
{
  NRF_LOG_INFO("Step_1");
  app_usbd_cdc_acm_write(&p_usbd_instance, "HELLO", 5);
}



Any ideas?

Thank you for your time!

Related