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.

CCS/TIDA-010024: TIDA-010024 Data Send

Part Number: TIDA-010024
Other Parts Discussed in Thread: TIDA-010021

Tool/software: Code Composer Studio

Hi, 

I want to ask questions about the data transmission and reception parts in TIDA-010021. I try the transmit a message to specific node in 6lowpan network. I try the readmeter() part in this but I couldn't figure it out. For example I have 100 nodes in my 6lowpan network. I want the send message node 57 or receive message from it. How can I do it ?  Which part may I use about reaching the nodes, id or ip addresses ? 

Also, what is the difference between poll and push examples ? I want the create mesh 6lowpan network. Which one more effective poll or push ?

  • Hi,

    You can send data to a specific node in the network. You can find an example to send a data in the handling routine of the APP_TX_DATA event in the the app_task. You will need to know the destination IP address of the target node.

    The design guide describes the difference between poll and push examples as shown below.

    "For the UDP poll example, end nodes send UDP data only when they receive the poll message from the root node. This example is popular in a dense network since it can control network traffic effectively regardless of the network size with the cost of polling overheads. For the UDP push example,
    end nodes send UDP data whenever they have data to send. Compared to the UDP poll-based approach, this technique does not require the polling overhead, while it increases collision probability among transmissions of the end nodes in a dense network."

    Regards,
    Wonsoo
  • Thanks for reply. I try it but I couldn't figure it out, where should I write in code? How  APP_TASK_DATA  could send the data ? This reference design's codes are too complicated for me .Can you give me example about that?

    Best regards

  • Hi,

    Yon can find some example code lines in app_task_node.c.

    The following API is to send data from application to the UDP.
    uip_udp_packet_send_post(&udp_context.udp_socket, pmsg, pmsg->size, &dst->addr, UIP_NTOHS(dst->port));

    An example to fill out UDP context information (including IPv6 address and port numbers, ...) along with msg can be found in the following codes.

    void
    udp_event_handler(udp_context_t *ctx)
    {
    char *appdata;
    #if (POLL_APP)
    udp_address_t remote;
    #endif

    //copy received data, size, and seqNo
    appdata=&(appRxFifo[appRxFifo_ReadIdx].c[UIP_IPUDPH_LEN + UIP_LLH_LEN]);
    //parse seqno and size (based on application data format in simple-udp-meter.h)
    memcpy(&rcvd_seqno, appdata, sizeof(rcvd_seqno));
    memcpy(&rcvd_size, appdata + sizeof(rcvd_seqno), sizeof(rcvd_size));

    #if (POLL_APP)
    //parse src address
    uip_ipaddr_copy(&remote.addr, &APP_UIP_IP_BUF->srcipaddr);
    remote.port = APP_UIP_UDP_BUF->srcport;

    sample_udp_echoback(ctx, &remote, pudp_msg);
    #endif
    }

    Regards,
    Wonsoo
  • Thank you so much for reply. It is very helpful for me. I want to ask few question.

    I send a data one launchpad to another like this

    ################
    ........
    case APP_TX_DATA:
    {
    #if (POLL_APP)
    #if 0
    // start sending UDP data after the network is fully formed with the given number of test nodes
    if(!network_formed)
    {
    if(uip_ds6_route_num_routes()==NUM_TEST_NODES)
    network_formed=true;
    }
    else
    {
    sample_udp_poll(pudp_msg);
    }
    #else

    if(cnt>5)
    {
    SamplePollMsg_t testMsg;
    testMsg.seqno = 11;
    testMsg.txTimestamp[0] = 51;
    testMsg.txTimestamp[1] = 28;
    testMsg.size = 6;
    memcpy(testMsg.pollReq, "test", 4);
    sample_udp_poll(&testMsg);

    ################

    I try the send "test" with root part of my launchpad(app_task_root.c). When I send the message to node part. I want to get response. Which part in the app_task_node.c receive the message and how can I find the recieved message which variable ? Is that appdata ?

    I use memmem() for searching data in file like ;

    ######################
    .....................
    char *s = memmem(appdata, 30, "test",4);

    if(s != 0)
    {

    sprintf(msg4,"test");

    UART_write(handle, msg3, strlen(msg3));
    UART_write(handle, msg4, strlen(msg4));




    ######################

    Is that correct way to find it ? Also, I think data is stored AppRxFifo. How can reach data ?

    I need your help so much . Thank you for everything.

  • Hi, 

    The poll examples for root and node implements the echo-back case you mentioned here. Please, review the codes of how the end node receives data, swap the source IP to destination IP, and copy the received data to echo back. The sample_udp_echoback function implement the echo-back procedure. 

    To debug your specific implementation, I would recommend you to run your codes in a debug mode provided by CCS and put some breakpoints to verify your codes are correctly implemented. 

    Regards,

    Wonsoo

  • Hi,

    I was tried the send char * data with using pmsg->pollReq but it doesn't work. Can this application send char * data ?

  • Hi,

    There is no limit on sending any types of data. You might need to trace what you received vs. what you sent in the CCS debugger.

    Regards,
    Wonsoo