This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Tool/software: Code Composer Studio
Hi,
We are porting the TI-15.4 stack sensor.c example to our MSP-EXP432E401Y platform removing all 15.4 stack-related calls and using instead Ethernet. We are using a mmWave sensor from TI so we have defined two UARTs for configuration purposes and for actual sensor data (MSS_LOGGER). A main task will handle events triggered by a mmwaveTask as explained in the demo code provided by TI. We are integrating the mmWave sensor and MSP-EXP432E401Y and we are having issues with the UART mapping between boards. This is a snippet of the code:
void mmwaveTaskInit(void) { /* Construct Semaphore */ Semaphore_Params semParams; Semaphore_Params_init(&semParams); Semaphore_construct(&mmwaveSemStruct, 0, &semParams); mmwaveSemHandle = Semaphore_handle(&mmwaveSemStruct); /* Configure display task. */ Task_Params taskParams; Task_Params_init(&taskParams); taskParams.stack = mmwaveTaskStack; taskParams.stackSize = MMWAVE_TASK_STACK_SIZE; taskParams.priority = MMWAVE_TASK_PRIORITY; Task_construct(&mmwaveTask, mmwaveTaskFxn, &taskParams, NULL); /* Open mmwave configuration UART port */ UART_Params_init(&mmwaveUartParams); mmwaveUartParams.writeDataMode = UART_DATA_BINARY; mmwaveUartParams.readDataMode = UART_DATA_BINARY; mmwaveUartParams.readReturnMode = UART_RETURN_FULL; mmwaveUartParams.readEcho = UART_ECHO_OFF; mmwaveUartParams.baudRate = 115200; //Configuration baud rate mmwaveUartParams.readTimeout = 500000 / Clock_tickPeriod; mmwaveUartHandle = UART_open(Board_UART0, &mmwaveUartParams); if (mmwaveUartHandle == NULL) { /* UART_open() failed */ while (1); } /* Open mmwave logger UART port */ UART_Params_init(&mmwaveLoggerUartParams); mmwaveLoggerUartParams.writeDataMode = UART_DATA_BINARY; mmwaveLoggerUartParams.readDataMode = UART_DATA_BINARY; mmwaveLoggerUartParams.readReturnMode = UART_RETURN_FULL; mmwaveLoggerUartParams.readEcho = UART_ECHO_OFF; mmwaveLoggerUartParams.baudRate = 921600; mmwaveLoggerUartParams.readTimeout = 500000 / Clock_tickPeriod; mmwaveLoggerUartHandle = UART_open(Board_UART2, &mmwaveLoggerUartParams); if (mmwaveLoggerUartHandle == NULL) { /* UART_open() failed */ while (1); } }
However, we end up in having a wrong mmwaveLoggerUartHandle. As far as I know, hypothesis are either 1) UART was already initialized or 2) An error happened during initialization. UART_init() is called in the main thread:
int main() { /* Call driver init functions */ Board_init(); GPIO_init(); UART_init();
So we assume the error happened because of being previously initialized. All UART interfaces have been defined in Board.h, MSP_EXP432E401Y.c and its header file accordingly:
/* UART configuration structure */ const UARTMSP432E4_HWAttrs uartMSP432E4HWAttrs[MSP_EXP432E401Y_UARTCOUNT] = { { .baseAddr = UART0_BASE, .intNum = INT_UART0, .intPriority = (~0), .flowControl = UARTMSP432E4_FLOWCTRL_NONE, .ringBufPtr = uartMSP432E4RingBuffer[MSP_EXP432E401Y_UART0], .ringBufSize = sizeof(uartMSP432E4RingBuffer[MSP_EXP432E401Y_UART0]), .rxPin = UARTMSP432E4_PA0_U0RX, .txPin = UARTMSP432E4_PA1_U0TX, .ctsPin = UARTMSP432E4_PIN_UNASSIGNED, .rtsPin = UARTMSP432E4_PIN_UNASSIGNED, .errorFxn = NULL }, { .baseAddr = UART1_BASE, .intNum = INT_UART1, .intPriority = (~0), .flowControl = UARTMSP432E4_FLOWCTRL_NONE, .ringBufPtr = uartMSP432E4RingBuffer[MSP_EXP432E401Y_UART1], .ringBufSize = sizeof(uartMSP432E4RingBuffer[MSP_EXP432E401Y_UART1]), .rxPin = UARTMSP432E4_PB0_U1RX, .txPin = UARTMSP432E4_PB1_U1TX, .ctsPin = UARTMSP432E4_PIN_UNASSIGNED, .rtsPin = UARTMSP432E4_PIN_UNASSIGNED, .errorFxn = NULL }, { .baseAddr = UART2_BASE, .intNum = INT_UART2, .intPriority = (~0), .flowControl = UARTMSP432E4_FLOWCTRL_NONE, .ringBufPtr = uartMSP432E4RingBuffer[MSP_EXP432E401Y_UART2], .ringBufSize = sizeof(uartMSP432E4RingBuffer[MSP_EXP432E401Y_UART2]), // .rxPin = UARTMSP432E4_PD4_U2RX, .rxPin = UARTMSP432E4_PD4_U2RX, .txPin = UARTMSP432E4_PD5_U2TX, .ctsPin = UARTMSP432E4_PIN_UNASSIGNED, .rtsPin = UARTMSP432E4_PIN_UNASSIGNED, .errorFxn = NULL }, { .baseAddr = UART3_BASE, .intNum = INT_UART3, .intPriority = (~0), .flowControl = UARTMSP432E4_FLOWCTRL_NONE, .ringBufPtr = uartMSP432E4RingBuffer[MSP_EXP432E401Y_UART3], .ringBufSize = sizeof(uartMSP432E4RingBuffer[MSP_EXP432E401Y_UART3]), .rxPin = UARTMSP432E4_PA4_U3RX, .txPin = UARTMSP432E4_PA5_U3TX, .ctsPin = UARTMSP432E4_PIN_UNASSIGNED, .rtsPin = UARTMSP432E4_PIN_UNASSIGNED, .errorFxn = NULL }, { .baseAddr = UART4_BASE, .intNum = INT_UART4, .intPriority = (~0), .flowControl = UARTMSP432E4_FLOWCTRL_NONE, .ringBufPtr = uartMSP432E4RingBuffer[MSP_EXP432E401Y_UART4], .ringBufSize = sizeof(uartMSP432E4RingBuffer[MSP_EXP432E401Y_UART4]), .rxPin = UARTMSP432E4_PA2_U4RX, .txPin = UARTMSP432E4_PA3_U4TX, .ctsPin = UARTMSP432E4_PIN_UNASSIGNED, .rtsPin = UARTMSP432E4_PIN_UNASSIGNED, .errorFxn = NULL }, { .baseAddr = UART5_BASE, .intNum = INT_UART5, .intPriority = (~0), .flowControl = UARTMSP432E4_FLOWCTRL_NONE, .ringBufPtr = uartMSP432E4RingBuffer[MSP_EXP432E401Y_UART5], .ringBufSize = sizeof(uartMSP432E4RingBuffer[MSP_EXP432E401Y_UART5]), .rxPin = UARTMSP432E4_PC6_U5RX, .txPin = UARTMSP432E4_PC7_U5TX, .ctsPin = UARTMSP432E4_PIN_UNASSIGNED, .rtsPin = UARTMSP432E4_PIN_UNASSIGNED, .errorFxn = NULL }, { .baseAddr = UART6_BASE, .intNum = INT_UART6, .intPriority = (~0), .flowControl = UARTMSP432E4_FLOWCTRL_NONE, .ringBufPtr = uartMSP432E4RingBuffer[MSP_EXP432E401Y_UART6], .ringBufSize = sizeof(uartMSP432E4RingBuffer[MSP_EXP432E401Y_UART6]), .rxPin = UARTMSP432E4_PP0_U6RX, .txPin = UARTMSP432E4_PP1_U6TX, .ctsPin = UARTMSP432E4_PIN_UNASSIGNED, .rtsPin = UARTMSP432E4_PIN_UNASSIGNED, .errorFxn = NULL }, { .baseAddr = UART7_BASE, .intNum = INT_UART7, .intPriority = (~0), .flowControl = UARTMSP432E4_FLOWCTRL_NONE, .ringBufPtr = uartMSP432E4RingBuffer[MSP_EXP432E401Y_UART7], .ringBufSize = sizeof(uartMSP432E4RingBuffer[MSP_EXP432E401Y_UART7]), .rxPin = UARTMSP432E4_PC4_U7RX, .txPin = UARTMSP432E4_PC5_U7TX, .ctsPin = UARTMSP432E4_PIN_UNASSIGNED, .rtsPin = UARTMSP432E4_PIN_UNASSIGNED, .errorFxn = NULL } };
At this stage, we want to use the backchannel UART (UART0) for either configuration of the mmWave sensor or data logger, just for debugging and understanding the whole architecture.
My questions are:
mmwaveUartHandle = UART_open(Board_UART7, &mmwaveUartParams);
and define in gpioPinConfigs:
GPIOMSP432E4_PL4 | GPIO_CFG_IN_PD,
and map it also to any .rxPin of any UART?
Thanks for your help in advance.
Regards,
Mario
Hi,
I sent it to a concerned engineer. We will get back to you ASAP. Please bear with us.
Thanks,
PM
Hi Mario,
What is the mmWave demo code that you are referring to?
When you say you are seeing an invalid handle returned, I assume you are referring to the fact that you get a null return. Even though TI Drivers is linked as a library, you can drop in the source code for the UART driver into your project in order to step through it with the debugger to see where it is failing. You may have to update your includes, but this typically helps to give an idea of if it is failing because the UART is already opened or if there is an issue with indexing the config structure.
Did you update your MSP_EXP432E401Y.h file to reflect the fact that you are adding more UART configurations?
Can you clarify what you mean by the last part about the MSS_LOGGER pin? I'm not familiar with the mmWave board and I'm not sure I understand how this relates to the UART configuration.
Thanks,
Ben M
Hi Ben,
Thanks for your reply.
What is the mmWave demo code that you are referring to?
There are two demo codes that we are using in our project. First one is one that we build and flash using UniFlash on the mmWave sensor. It corresponds to the people count demo from the industrial mmWave sensors SDK. Second demo code is the one we are porting to the MSP432 and it is a refactored version of the sensor-collector example code from TI-15.4 stack. All calls to the 15.4 stack have been removed and we are moving to using Ethernet instead.
When you say you are seeing an invalid handle returned, I assume you are referring to the fact that you get a null return. Even though TI Drivers is linked as a library, you can drop in the source code for the UART driver into your project in order to step through it with the debugger to see where it is failing. You may have to update your includes, but this typically helps to give an idea of if it is failing because the UART is already opened or if there is an issue with indexing the config structure.
Correct, NULL handle return, but only for the second UART we want to open. The debugger showed us this. We enter the while(1) loop:
if (mmwaveLoggerUartHandle == NULL) { /* UART_open() failed */ while (1); }
Did you update your MSP_EXP432E401Y.h file to reflect the fact that you are adding more UART configurations?
Yes, we did. Refer to the code of my original post. We updated not only the header file, but also the .c file and Board.h files. Debugging the code shows we have 8 possible configurations (all of them).
Can you clarify what you mean by the last part about the MSS_LOGGER pin? I'm not familiar with the mmWave board and I'm not sure I understand how this relates to the UART configuration.
The mmWave sensor board (MMWAVEICBOOST) and the MSP-EXP432E401Y can be plugged in one on top the other using the BoosterPack 40-pin headers. Then, careful attention has to be paid on which pins are mapped to which UART between boards. Our question was which definitions on the UART do we have to change on the MSP432 (since the mmWave sensor will have a pre-built binary image running and little can be done).
I hope it's clear now.
Best regards,
Mario
I add the following:
Debugger shows that not even the first UART handle (mmwaveUartHandle) is working. There's an abnormal program termination when doing UART_write(mmwaveUartHandle, ...) meaning none of the UARTs are properly initialized or open.
Hope this helps.
Best regards,
Mario
Hi Mario,
Can you provide your changes to Board.h and the UART section of MSP_EXP432E401Y.h as well?
Thanks,
Alexis
Hi Alexis,
Board.h
#define Board_UART0 MSP_EXP432E401Y_UART0 #define Board_UART1 MSP_EXP432E401Y_UART1 #define Board_UART2 MSP_EXP432E401Y_UART2 #define Board_UART3 MSP_EXP432E401Y_UART3 ...
up to UART7
MSP_EXP432E401Y.h
/*! * @def MSP_EXP432E401Y_UARTName * @brief Enum of UARTs on the MSP_EXP432E401Y dev board */ typedef enum MSP_EXP432E401Y_UARTName { MSP_EXP432E401Y_UART0 = 0, MSP_EXP432E401Y_UART1, MSP_EXP432E401Y_UART2, MSP_EXP432E401Y_UART3, MSP_EXP432E401Y_UART4, MSP_EXP432E401Y_UART5, MSP_EXP432E401Y_UART6, MSP_EXP432E401Y_UART7, MSP_EXP432E401Y_UARTCOUNT } MSP_EXP432E401Y_UARTName;
MSP_EXP432E401Y.c
/* UART configuration structure */ const UARTMSP432E4_HWAttrs uartMSP432E4HWAttrs[MSP_EXP432E401Y_UARTCOUNT] = { { .baseAddr = UART0_BASE, .intNum = INT_UART0, .intPriority = (~0), .flowControl = UARTMSP432E4_FLOWCTRL_NONE, .ringBufPtr = uartMSP432E4RingBuffer[MSP_EXP432E401Y_UART0], .ringBufSize = sizeof(uartMSP432E4RingBuffer[MSP_EXP432E401Y_UART0]), .rxPin = UARTMSP432E4_PA0_U0RX, .txPin = UARTMSP432E4_PA1_U0TX, .ctsPin = UARTMSP432E4_PIN_UNASSIGNED, .rtsPin = UARTMSP432E4_PIN_UNASSIGNED, .errorFxn = NULL }, { .baseAddr = UART1_BASE, .intNum = INT_UART1, .intPriority = (~0), .flowControl = UARTMSP432E4_FLOWCTRL_NONE, .ringBufPtr = uartMSP432E4RingBuffer[MSP_EXP432E401Y_UART1], .ringBufSize = sizeof(uartMSP432E4RingBuffer[MSP_EXP432E401Y_UART1]), .rxPin = UARTMSP432E4_PB0_U1RX, .txPin = UARTMSP432E4_PB1_U1TX, .ctsPin = UARTMSP432E4_PIN_UNASSIGNED, .rtsPin = UARTMSP432E4_PIN_UNASSIGNED, .errorFxn = NULL }, { .baseAddr = UART2_BASE, .intNum = INT_UART2, .intPriority = (~0), .flowControl = UARTMSP432E4_FLOWCTRL_NONE, .ringBufPtr = uartMSP432E4RingBuffer[MSP_EXP432E401Y_UART2], .ringBufSize = sizeof(uartMSP432E4RingBuffer[MSP_EXP432E401Y_UART2]), // .rxPin = UARTMSP432E4_PD4_U2RX, .rxPin = UARTMSP432E4_PD4_U2RX, .txPin = UARTMSP432E4_PD5_U2TX, .ctsPin = UARTMSP432E4_PIN_UNASSIGNED, .rtsPin = UARTMSP432E4_PIN_UNASSIGNED, .errorFxn = NULL }, { .baseAddr = UART3_BASE, .intNum = INT_UART3, .intPriority = (~0), .flowControl = UARTMSP432E4_FLOWCTRL_NONE, .ringBufPtr = uartMSP432E4RingBuffer[MSP_EXP432E401Y_UART3], .ringBufSize = sizeof(uartMSP432E4RingBuffer[MSP_EXP432E401Y_UART3]), .rxPin = UARTMSP432E4_PA4_U3RX, .txPin = UARTMSP432E4_PA5_U3TX, .ctsPin = UARTMSP432E4_PIN_UNASSIGNED, .rtsPin = UARTMSP432E4_PIN_UNASSIGNED, .errorFxn = NULL }, { .baseAddr = UART4_BASE, .intNum = INT_UART4, .intPriority = (~0), .flowControl = UARTMSP432E4_FLOWCTRL_NONE, .ringBufPtr = uartMSP432E4RingBuffer[MSP_EXP432E401Y_UART4], .ringBufSize = sizeof(uartMSP432E4RingBuffer[MSP_EXP432E401Y_UART4]), .rxPin = UARTMSP432E4_PA2_U4RX, .txPin = UARTMSP432E4_PA3_U4TX, .ctsPin = UARTMSP432E4_PIN_UNASSIGNED, .rtsPin = UARTMSP432E4_PIN_UNASSIGNED, .errorFxn = NULL }, { .baseAddr = UART5_BASE, .intNum = INT_UART5, .intPriority = (~0), .flowControl = UARTMSP432E4_FLOWCTRL_NONE, .ringBufPtr = uartMSP432E4RingBuffer[MSP_EXP432E401Y_UART5], .ringBufSize = sizeof(uartMSP432E4RingBuffer[MSP_EXP432E401Y_UART5]), .rxPin = UARTMSP432E4_PC6_U5RX, .txPin = UARTMSP432E4_PC7_U5TX, .ctsPin = UARTMSP432E4_PIN_UNASSIGNED, .rtsPin = UARTMSP432E4_PIN_UNASSIGNED, .errorFxn = NULL }, { .baseAddr = UART6_BASE, .intNum = INT_UART6, .intPriority = (~0), .flowControl = UARTMSP432E4_FLOWCTRL_NONE, .ringBufPtr = uartMSP432E4RingBuffer[MSP_EXP432E401Y_UART6], .ringBufSize = sizeof(uartMSP432E4RingBuffer[MSP_EXP432E401Y_UART6]), .rxPin = UARTMSP432E4_PP0_U6RX, .txPin = UARTMSP432E4_PP1_U6TX, .ctsPin = UARTMSP432E4_PIN_UNASSIGNED, .rtsPin = UARTMSP432E4_PIN_UNASSIGNED, .errorFxn = NULL }, { .baseAddr = UART7_BASE, .intNum = INT_UART7, .intPriority = (~0), .flowControl = UARTMSP432E4_FLOWCTRL_NONE, .ringBufPtr = uartMSP432E4RingBuffer[MSP_EXP432E401Y_UART7], .ringBufSize = sizeof(uartMSP432E4RingBuffer[MSP_EXP432E401Y_UART7]), .rxPin = UARTMSP432E4_PC4_U7RX, .txPin = UARTMSP432E4_PC5_U7TX, .ctsPin = UARTMSP432E4_PIN_UNASSIGNED, .rtsPin = UARTMSP432E4_PIN_UNASSIGNED, .errorFxn = NULL } };
and
const UART_Config UART_config[MSP_EXP432E401Y_UARTCOUNT] = { { .fxnTablePtr = &UARTMSP432E4_fxnTable, .object = &uartMSP432E4Objects[MSP_EXP432E401Y_UART0], .hwAttrs = &uartMSP432E4HWAttrs[MSP_EXP432E401Y_UART0] }, { .fxnTablePtr = &UARTMSP432E4_fxnTable, .object = &uartMSP432E4Objects[MSP_EXP432E401Y_UART1], .hwAttrs = &uartMSP432E4HWAttrs[MSP_EXP432E401Y_UART1] }, { .fxnTablePtr = &UARTMSP432E4_fxnTable, .object = &uartMSP432E4Objects[MSP_EXP432E401Y_UART2], .hwAttrs = &uartMSP432E4HWAttrs[MSP_EXP432E401Y_UART2] }, { .fxnTablePtr = &UARTMSP432E4_fxnTable, .object = &uartMSP432E4Objects[MSP_EXP432E401Y_UART3], .hwAttrs = &uartMSP432E4HWAttrs[MSP_EXP432E401Y_UART3] }, { .fxnTablePtr = &UARTMSP432E4_fxnTable, .object = &uartMSP432E4Objects[MSP_EXP432E401Y_UART4], .hwAttrs = &uartMSP432E4HWAttrs[MSP_EXP432E401Y_UART4] }, { .fxnTablePtr = &UARTMSP432E4_fxnTable, .object = &uartMSP432E4Objects[MSP_EXP432E401Y_UART5], .hwAttrs = &uartMSP432E4HWAttrs[MSP_EXP432E401Y_UART5] }, { .fxnTablePtr = &UARTMSP432E4_fxnTable, .object = &uartMSP432E4Objects[MSP_EXP432E401Y_UART6], .hwAttrs = &uartMSP432E4HWAttrs[MSP_EXP432E401Y_UART6] }, { .fxnTablePtr = &UARTMSP432E4_fxnTable, .object = &uartMSP432E4Objects[MSP_EXP432E401Y_UART7], .hwAttrs = &uartMSP432E4HWAttrs[MSP_EXP432E401Y_UART7] } };
Could it be:
Best regards,
Mario
Hi Mario,
Thanks for sharing the files. They do all seem to be correct. I don't expect it is likely an issue with the build process.
What SDK version are you using?
Can you describe how you are doing the porting from the original project to the MSP432 device? Did you update which libraries are being linked (drivers_msp432e4 and msp432e4_driverlib)?
It would be great if you could run a simple test where you drop these configuration files (MSP_EXP432E401Y.c, MSP_EXP432E401Y.h, and BOARD.h) into the portable example from the MSP432E4 SDK then add the lines for opening the UART and see if you get the same issue.
Thanks,
Ben M
Hi Ben,
Thanks for your reply.
What SDK version are you using?
simplelink_msp432e4_sdk_3_20_00_10
Can you describe how you are doing the porting from the original project to the MSP432 device? Did you update which libraries are being linked (drivers_msp432e4 and msp432e4_driverlib)?
The porting was basically moving the code to the "hello" example project of the SDK removing all non-necessary calls. Compiling and linking was left almost untouched.
It would be great if you could run a simple test where you drop these configuration files (MSP_EXP432E401Y.c, MSP_EXP432E401Y.h, and BOARD.h) into the portable example from the MSP432E4 SDK then add the lines for opening the UART and see if you get the same issue.
We have tried this (dropping the board files) on the uartecho example project. And it worked! However, we believe the root cause was not including the base tirtos_css project on the hello project. Apart from that, we have seen the uartecho project implements POSIX while the hello does not. I guess this is a minor difference (another-abstraction-layer-in-the-middle only). So we are now able to see the UART being brought up.
We are moving now to configure the mmWave sensor from the MSP432.
Thanks for your help guys.
Best regards,
Mario
Hi Mario,
Great! Yes, the sysbios examples (like hello project) are designed to run directly on top of TI-RTOS to showcase how it works. However, the drivers are built on top of the posix layer which allows the demos to run both on TI-RTOS and FreeRTOS without changes to the application layer.
I'm glad you were able to catch this and get it working!
Best Regards,
Ben M
**Attention** This is a public forum