Other Parts Discussed in Thread: CC1310
Hello,
I am working on "UART" of CC1310 LP and with collector code.
CCS Version 10
simplelink_cc13x0_sdk_4_20_00_05.
I am missing out some character as shown in below shared screenshot those characters are replaced with <0x80>.
In some cases , when i am debugging by placing breakpoint at line no 6(If statement) in uartRxCallback function then i am getting the desired output.
const UARTCC26XX_HWAttrsV2 uartCC26XXHWAttrs[CC1310_LAUNCHXL_UARTCOUNT] = { { .baseAddr = UART0_BASE, .powerMngrId = PowerCC26XX_PERIPH_UART0, .intNum = INT_UART0_COMB, .intPriority = ~0, .swiPriority = 0, .txPin = CC1310_LAUNCHXL_UART_TX, .rxPin = CC1310_LAUNCHXL_UART_RX, .ctsPin = PIN_UNASSIGNED, .rtsPin = PIN_UNASSIGNED, .ringBufPtr = uartCC26XXRingBuffer[CC1310_LAUNCHXL_UART0], .ringBufSize = sizeof(uartCC26XXRingBuffer[CC1310_LAUNCHXL_UART0]), .txIntFifoThr = UARTCC26XX_FIFO_THRESHOLD_1_8, .rxIntFifoThr = UARTCC26XX_FIFO_THRESHOLD_1_8, /* .rxIntFifoThr = UARTCC26XX_FIFO_THRESHOLD_7_8, */ .errorFxn = NULL } };
Uart parameter configuration.
#if defined(BOARD_DISPLAY_USE_UART) /* Enable System_printf(..) UART output */ UART_init(); UART_Params_init(&uartParams); #ifndef TIMAC_AGAMA_FPGA //uartParams.writeMode = UART_MODE_CALLBACK; uartParams.readMode = UART_MODE_CALLBACK; uartParams.readCallback = &uartRxCallBack; uartParams.writeDataMode = UART_DATA_TEXT; uartParams.readDataMode = UART_DATA_TEXT; uartParams.readReturnMode = UART_RETURN_NEWLINE; uartParams.readEcho = UART_ECHO_OFF; uartParams.baudRate = 115200; #else uartParams.baudRate = 460800; #endif UartPrintf_init(UART_open(Board_UART0, &uartParams)); /*UART_control(hUart, UARTCC26XX_CMD_RETURN_PARTIAL_ENABLE, NULL);*/ #endif /* BOARD_DISPLAY_USE_UART */
This is uartRxCallBack function in which i am receiving byte by byte data and storing it in "buff" array.
Shared the uartsRxCallBack snippet below.
void uartRxCallBack(UART_Handle handle, void *Rx_char, size_t size) { /* buff is a global char array of 64 bytes */ buff[idx] = *(uint8_t*) Rx_char; if (buff[idx] == '\r') { MsgObj msg; msg.id = 0x19; /* String Terminating */ buff[idx] = '\0'; /* Passing address of string */ msg.val = buff; idx = 0; /* memset(buff, 0x00, sizeof(buff)); */ Mailbox_post(mbxHandle, &msg, BIOS_NO_WAIT); } else { idx++; } UART_read(handle, &Rx_char, 1); }
Void MailTaskFxn(UArg a0, UArg a1) { Mailbox_Params_init (&mbxParams); mbxParams.buf = &mailboxBuffer; mbxParams.bufSize = sizeof(mailboxBuffer); Mailbox_construct(&mbxStruct, sizeof(MsgObj), NUMMSGS, &mbxParams, NULL); mbxHandle = Mailbox_handle(&mbxStruct); MsgObj payload; uint8_t *ptr = NULL; while (true) { if(Mailbox_pend(mbxHandle, &payload, BIOS_WAIT_FOREVER)) { /* System_printf("payload received: 0x%02x\r\n", payload.id); */ ptr = payload.val; /* LCD_WRITE_STRING((char *)payload.val,10); */ UART_write(hUart,ptr,strlen((char*)ptr)); /* To display properly on terminal*/ UART_write(hUart,"\n",1); System_flush(); } } }
So, I have created a task for Mail_box as shown in above code snippet and i am printing the received bytes from here by using "UART_write" which i have received in "buff" array .
And the very same logic i tried with "uartecho" example of the sdk and it was working fine.