MQX 4.0/3.8/3.7 USB CDC virtual_com example not working on Kwikstik board

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

MQX 4.0/3.8/3.7 USB CDC virtual_com example not working on Kwikstik board

522 Views
mohamednourmejd
Contributor I

Hello,

I want to establish a serial communication between the Kwikstik board and a host PC that runs windows 7/ 32 bit over USB port (after specifying the fsl_ucwxp.inf file within the MQX usb stack directory ), so I am using the virtual_com example from the MQX usb device example. So far I have been able to send data from PC to the board through the terminal window application (PE terminal)advanced serial monitor or other terminals, but as the application is meant to do an echo  behavior, nothing shows up on the terminal even that while debugging every thing looks like working just fine:

* the board receives the right sequence of sent data (only when using dvanced serial monitor terminal)

* USB_Class_CDC_Send_Data() just return USB_OK, but USB_APP_SEND_COMPLETE event doesn't show up.

* while examining the BDT in RAM: looks it does contain the right data and buffers pointers associated to the endpoint 

* USB_Class_Send_Data() call does not occur because (producer - consumer) never reach 1. (in my case trying to send several bytes to the board)

* USB0 registers USB0_FRMNUML and USB0_FRMNUMH arre continuously changing value while debugging the send sequence of USB_Class_CDC_Send_Data(). 

I have compiled the MQX libraries with not modification of the user_config.h file

Is there any additional specific hardware initialization that should be done before compiling the bsp library (like adding the usb component)? Or am I missing some mqx usb stack feature.

Is anybody facing the same problem with MQX usb stack? I need some insight please?  

0 Kudos
1 Reply

218 Views
CarlosCasillas
NXP Employee
NXP Employee

Hi Mejdoub,

The KWIKSTIK’s BSP comes with the default console channel on “iodebug”, which is the terminal of the JTAG debugger; therefore it only works when the debugger is connected (try running the application while debugging and it will work). However, when running on stand-alone mode, the debugger doesn’t respond, and the application will be halted. You could refer to section 7.2.11 “KwikStik (MK40X256)” of the MQX v4.1 Getting Started document, where is mentioned that the default console channel is the “iodebug”, and that it could be changed to use “ttyf”. In order to do so and avoid the blocking issue, please open the KWIKSTIK’s BSP project, and then, the file “kwikstik-k40x256.h”, change to 1 the following macro definition for enabling the TTYF:

#ifndef BSPCFG_ENABLE_TTYF

    #define BSPCFG_ENABLE_TTYF              0

#endif

Also, it is required to indicate that TTYF will be the default console channel, so, on the same file, locate the following macro, and replace the "iodebug:" with "ttyf:":

#ifndef BSP_DEFAULT_IO_CHANNEL

    #if BSPCFG_ENABLE_IODEBUG

        #define BSP_DEFAULT_IO_CHANNEL                      "iodebug:"  /* IDE debug console */

Finally, you need to recompile the BSP, then the PSP, and at the end, the CDC application


Hope this will be useful for you.
Best regards!
/Carlos

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos