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.

CC3200: Uart, Data is not in order

Part Number: CC3200

Hi,
I'm using 2 uarts (uart-0 and uart-1), basically Uart-1 will received data (requests) from another computer or system and send back the response and with the help of Uart-0 i will just keep an eye on the data flow (print the received/transmitted data). the Uart-0 is with DMA and it's working fine but i'm facing issue with Uart-1 (I'm not using DMA for this one), the issue is, the data i'm receiving is not in the same order i send. for example:

first iteration 

i send: 01-23-45-67-89-ab-cd-ef

i received: 01

second iteration

i send: 01-23-45-67-89-ab-cd-ef

i receive: 23-45-67-89-ab-cd-ef-01

Third iteration

i send: 01-23-45-67-89-ab-cd-ef

i receive: 23-45-67-89-ab-cd-ef-01

 

This is part of my code:

Uart1 configuration in pinmux

MAP_PRCMPeripheralClkEnable(PRCM_UARTA1, PRCM_RUN_MODE_CLK);
MAP_PinTypeUART(ucPin_RS485TX, PIN_MODE_2);
MAP_PinTypeUART(ucPin_RS485RX, PIN_MODE_2);
MAP_UARTConfigSetExpClk(UARTA1_BASE, MAP_PRCMPeripheralClockGet(PRCM_UARTA1),
                        9600, (UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE |
                        UART_CONFIG_PAR_NONE));
                        
//MAP_UARTFlowControlSet(UARTA1_BASE, UART_FLOWCONTROL_NONE);
MAP_UARTFIFODisable(UARTA1_BASE);
UARTIntRegister(UARTA1_BASE, vUartHandleIsr);
MAP_IntPrioritySet(INT_UARTA1, IRQ_PRIORITY_UART1); //IRQ_PRIORITY_UART1 = INT_PRIORITY_LVL_1
UARTIntClear(UARTA1_BASE, UART_INT_RX);
UARTIntEnable(UARTA1_BASE, UART_INT_RX);

vUartHandleIsr function:

static void vUartHandleIsr(void)
{
	unsigned long IrqStatus;
	unsigned char ucReceivedByte;
	
	IrqStatus = UARTIntStatus(UARTA1_BASE, true); //0
	UARTIntClear(UARTA1_BASE, IrqStatus);

	//If new char had been received
	if((IrqStatus & UART_INT_RX) && MAP_UARTCharsAvail(UARTA1_BASE))
	{
		ucReceivedByte = (unsigned char)(MAP_UARTCharGetNonBlocking(UARTA1_BASE));
		
		vPrintf("%x\r\n", ucReceivedByte);
	
		// <call function to store received data in buffer>
	}
}

i believe this code is so close to the UART example, i'm not sure what causes the Uart to miss the rest of the data in the first time i send data (it accepts only the first byte) then the for the next data array i send, always the first byte become the last. hope i can find help here,

Best regards,

Habib

  • The soon i changed the position of the UART configuration to pinmux (i was doing the config in another place because i wanted the setting to be editable, like the baud rate etc) and by changing back the code lines of the configuration to pinmux file, it works fine, i was going to delete this post, but i couldn't find the delete button, so at least i will leave an answer so no one will get confused.