using SDK SHELL with Serial Manager on USB CDC Interface.

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

using SDK SHELL with Serial Manager on USB CDC Interface.

1,148 Views
mhanuel
Contributor II

I am trying to get working a basic demo of using the SHELL module of SDK with the CDC USB interface for RT1010.

After merging the shell demo app with the hello world cdc demo app, I cannot receive correctly the data from serial interface.

The problem is the Shell demo alone works perfect but I need non blocking mode, then hello world cdc demo works perfect on non blocking mode. When merging I can debug the serial reception to the ISR of Serial Manager callback, such as i send some serial command and make a breakpoint in SerialManager_RxCallback function, but then I am seeing that the code never reach the function SerialManager_Task(handle);  which is the point of non blocking, instead of calling SHELL_Task(s_shellHandle); from the main loop as this will block until exit. After getting the ISR and calling SerialManager_Task, this indeed whould call the registered callback , such as serialWriteHandle->callback. 

Under SHELL_SerialManagerRxCallback, when non blocking is enable, the call to SHELL_Task is produced.

Now what I have found is that a consequence of something a I am probably missing, after hitting the Serial Manager ISR, there is a line that checks for some buffer existence, such as 

if ((handle->openedReadHandleHead != NULL) && (handle->openedReadHandleHead->transfer.buffer != NULL))

This buffer is NULL in fact. 

I have seen that the only place where this buffer is initialize is under the function SerialManager_ReadNonBlocking, I have try to call this function before hand but then I noticed that further down in the SerialManager_RxCallback, after I have received the data there is an if clause which enter to not do anything such as

if (handle->openedReadHandleHead->transfer.length > handle->openedReadHandleHead->transfer.soFar)
{

// HERE IS WHERE MY CODE ENDS 
}
else
{
if (kSerialManager_TransmissionBlocking == handle->openedReadHandleHead->transfer.mode)
{
handle->openedReadHandleHead->transfer.buffer = NULL;
}
else
{
handle->openedReadHandleHead->transfer.status = kStatus_SerialManager_Success;

#if defined(OSA_USED)

#if (defined(SERIAL_MANAGER_USE_COMMON_TASK) && (SERIAL_MANAGER_USE_COMMON_TASK > 0U))
handle->commontaskMsg.callback = SerialManager_Task;
handle->commontaskMsg.callbackParam = handle;
COMMON_TASK_post_message(&handle->commontaskMsg);
#else
(void)OSA_EventSet((osa_event_handle_t)handle->event, SERIAL_EVENT_DATA_RECEIVED);
#endif

#else
SerialManager_Task(handle);
#endif
}
}

Does someone at NXP has experience working with this pieces of code that can help please?

Many thanks in advance,

Labels (1)
0 Kudos
2 Replies

455 Views
Mc2023
Contributor IV

Hi @mhanuel,

Did you manage to have a basic demo using the SHELL module of SDK with the CDC USB interface?

I am trying to do the same thing.

Best regards,

 

0 Kudos

1,103 Views
mjbcswitzerland
Specialist V

Hi Manuel

If you need a professional solution for this requirement that works out-of-the-box on any 1010..1064 try the attached (with OTA and serial loading and complete AES256 code and clone protection built in) - guide at https://www.utasker.com/docs/iMX/uTaskerLoader_TestDrive.pdf
[Tip: press SW3 to enter loader or press SW9 to start application]
It has a command shell on the LPUART (debugger's VCOM by defaultat 115kBaud) and will move it to the USB-CDC interface when connected (and enter key hit - command "quit" on LPUART if used first). There are various additional features such as USB-CDC to LPUART bridging, USB-MSD or USB speed tests, SPI parameter and file system etc...

Regards

Mark
[uTasker project developer for Kinetis and i.MX RT]

! Out-of-the-box i.MX RT and Kinetis solution for professionals preferring to concentrate on product development and completion !
! Project compatibility between Kinetis and i.MX RT parts (single library) and accurate i.MX RT simulation in Visual Studio     !
! Remote desktop training and remote debugging service on request                                                               !
0 Kudos