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.

CC1310: Operating modes UART?

Part Number: CC1310

Tool/software:

Operating modes UART?


I have interfaced a sensor with LoRa to my UART bus on CC1310. When I send a command to the sensor it responds “+OK” indicating that the command was successful. When I sent the command requesting data it responds to me, the frame looks something like this “+OK\r\n+RCV=3,5,HELLO,-13,23”.

I have read that the following configuration returns when buffer full or a new line has been detected on reception.

void uartLoRa_Init(void){

UART_init();
UART_Params uartParams;
UART_Params_init(&uartParams);
uartParams.writeDataMode = UART_DATA_TEXT;//UART_DATA_BINARY;
uartParams.readDataMode = UART_DATA_TEXT;//UART_DATA_BINARY;
uartParams.readMode = UART_MODE_CALLBACK;
uartParams.readReturnMode = UART_RETURN_NEWLINE; 
uartParams.writeMode = UART_MODE_CALLBACK;
uartParams.readCallback = RXUartCb;
uartParams.writeCallback = TXUartCb;
uartParams.baudRate = 115200;
uart = UART_open(Board_UART0, &uartParams);//*/


}


Under this UART configuration when the character “\n” is detected in my response with data will the callback be called?

thanks in advance.

  • Hi J,

    Here is what our driver is saying:

    Have you tried the code that you have shared? Is there a bug?

    Regards,

    Arthur

  • Hi Arthur.

    I have tested the shared code and have not observed any difference. I am reading the following post.


    e2e.ti.com/.../cc1310-cc1310-uart-interrupt-using-callback-api-s

    From what I now understand some functions in the driver are not available.

  • Hi Arthur.

    I am now using the following configuration in UART.

    void uartLoRa_Init(void){

    UART_init();
    UART_Params uartParams;
    UART_Params_init(&uartParams);
    uartParams.writeDataMode = UART_DATA_BINARY;
    uartParams.readDataMode = UART_DATA_BINARY;
    uartParams.readMode = UART_MODE_CALLBACK;
    uartParams.writeMode = UART_MODE_CALLBACK;
    uartParams.readCallback = RXUartCb;
    uartParams.writeCallback = TXUartCb;
    uartParams.baudRate = 115200;
    uart = UART_open(Board_UART0, &uartParams);
    }

    I am relying on this comment made in another post.

    CC1310: CC1310: UART interrupt using Callback Api's - Sub-1 GHz forum - Sub-1 GHz - TI E2E support forums

    "When not using return partial, you will only get the callback once the given number of bytes has been received OR if there was a error detected (as this leads to the operation being canceled). Return partial is useful as it allows you to receive an unknown number of bytes. Say you know your IOT device sends at most 200 bytes, then you can say that you expect up to 200 bytes and still get a callback if only receiving 50 bytes. "

    In my application when the receiver is on line it answers me a frame with 69 bytes, which works perfect.
    The problem is when the receiver is offline and the CC1310 UART only receives 5 bytes.
    According to the comment in the previous post I made reference to, I know my maximum bytes (69) and it's ok, but according to the theory, even receiving only 5 bytes I should call the callback but it doesn't work.

    Do you have any idea why it doesn't?

    thanks in advance.

    char buffer01[]="AT+SEND=5,4,CMD1\r\n";
    
    static void Task_RF(UArg arg0, UArg arg1){
    uartLoRa_Init();
    
    
    
    while(1){
    
       
    
    if(motionFlag){
    
    switch(status){
    
           case Send_CMD01:{
    
           UART_write(uart,buffer01, strlen(buffer01));
           usleep(300000);
    
           Noc.status = RX_CMD01;
           break;
    }
    
    case RX_CMD01:{
    
        UART_control(uart, UARTCC26XX_CMD_RETURN_PARTIAL_ENABLE, NULL);
        UART_read(uart, &data,69);
        usleep(100000);
    
    
         break;
    }
    	}
    		}
    			}	
    			
    static void RXUartCb(UART_Handle handle, void *buf, size_t count){
    
           uint8_t BytesEsperados = 69;
            uint8_t i;
            if (count == BytesEsperados) {
    
               for( i = 0; i < count; i++){
                dataEstado[i] = ((char*)buf)[i];
               }
            }
            else{
                //I will return to the initial state Send_CMD01
    
            }
        
    }
    
    			
    
    void uart_Init(void){
    
         UART_init();
         UART_Params   uartParams;
         UART_Params_init(&uartParams);
         uartParams.writeDataMode = UART_DATA_BINARY;
         uartParams.readDataMode  = UART_DATA_BINARY;
         uartParams.readMode = UART_MODE_CALLBACK;
         uartParams.writeMode = UART_MODE_CALLBACK;
         uartParams.readCallback = RXUartCb;
         uartParams.writeCallback = TXUartCb;
         uartParams.baudRate = 115200;
         uart = UART_open(Board_UART0, &uartParams);
    
    
    }