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.

LAUNCHXL-CC1350: CC1350 UART Rx Tx in Contiki

Part Number: LAUNCHXL-CC1350
Other Parts Discussed in Thread: CC1350

Hello,

I want to send and receive data over uart in cc1350 with Contiki.

I am using following .c file. But it looks like  "if(ev == serial_line_event_message)" is not working. Do I need to add something in code? 

#include "contiki.h"
#include "dev/serial-line.h"
#include <stdio.h>

PROCESS(test_serial, "Serial line test process");
AUTOSTART_PROCESSES(&test_serial);

PROCESS_THREAD(test_serial, ev, data)
{
PROCESS_BEGIN();
printf("Hello");
for(;;) {

PROCESS_YIELD();

if(ev == serial_line_event_message) {

printf("received line: %s\n", (char *)data);
}
}
PROCESS_END();
}

Another question is how can I use callback function for UART data receive in contiki instead of waiting for data to be received?

  • I suggest you to refer to net-uart.c in cc26xx-web-demo.
  • I referred net-uart.c in cc26xx-demo.
    But again I stuck to the same problem.
    if(ev == serial_line_event_message)
    {
    }
    above if loop doesn't seems to work.

    I tried to initialize uart with following functions
    uart1_set_input(BAUD2UBR(115200));
    cc26xx_uart_set_input(serial_line_event_message);

    but it gives following error
    ../../../cpu/cc26xx-cc13xx/./dev/cc26xx-uart.h:79: error: previous declaration of 'cc26xx_uart_set_input' was here

    and if I comment the error line and run the program then also there is no output.

    I used jenkins.ibr.cs.tu-bs.de/.../a01941_source.html
    example as well but it just goes keep on printing " Waiting for serial data"
    and never receive data when data is sent to the uart.

    Is there something wrong?
  • Just found out the problem.

    Whenever we are going to write anything on the serial terminal we need to send 0x0a as the end of data string.

    In case of putty it is not possible to send it by just pressing enter.

    We need to have ctrl+enter

    I used teraterm. and did the following settings as highlighted below