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.

Linux/CC1310: CC1310_PING6 Issue

Part Number: CC1310

Tool/software: Linux

Dear sir,

 We are using the Chip set CC1310F128RSMR.we have downloaded the latest 6lbr-1.4.x from the Git.

In this Project we are using examples/ipv6/simple-rpl-udp,In that we are facing the issue with PRINT6ADDR API. If we use this API some times we are

unable print PRINT6 adderess.some of the bytes are missing.please help.

Regards,

Rajesh.M

  • PRINT6ADDR is an API just dumping the content of address pointer you input as a parameter. I think the problem is that somewhere in the application changes the content of address pointer. I suggest you to check it first.
  • Dear sir,

    If this is the address pointer isuue means every time it should give PRINT6 address issue,but i am able to print the address successfully but sometimes we are getting this issue.

    Regards,
    Rajesh.M
  • How do you call PRINT6ADDR in your application?
  • Dera sir,

    This is our Application please check,


    #include "contiki.h"
    #include "lib/random.h"
    #include "sys/ctimer.h"
    #include "sys/etimer.h"
    #include "net/ip/uip.h"
    #include "net/ipv6/uip-ds6.h"
    #include "net/ipv6/uip-nd6.h"
    #include <stdio.h>
    #include <string.h>

    #include "contiki-net.h"
    /**Serial line headers
    */
    #include "dev/serial-line.h"
    #include "dev/uart1.h"
    extern int serial_data_len;
    int Rcvd_len = 0;

    /**Debug headers
    */
    #include "debug.h"
    #define DEBUG DEBUG_PRINT
    #include "net/ip/uip-debug.h"

    #include "simple-udp.h"
    #define UDP_PORT 1234


    #define DATA_TX_PORT 7000 // master node Must Listen on this Port
    #define DATA_RX_PORT 7001


    #define SCAN_PORT 8000
    #define SCAN_ACK_PORT 8001

    static struct simple_udp_connection broadcast_connection;

    static uip_ipaddr_t paired_node_addr;
    //static uip_ipaddr_t addr;
    static unsigned char Macid[16];
    /*---------------------------------------------------------------------------*/
    PROCESS(broadcast_example_process, "UDP broadcast example process");
    AUTOSTART_PROCESSES(&broadcast_example_process);
    /*---------------------------------------------------------------------------*/
    static void Mac_Id_Set(unsigned char *MACID)
    {
    uip_ip6addr(&paired_node_addr, 0xfe80, 0, 0, 0,(uint16_t)((MACID[0])<<8|MACID[1]),(uint16_t)((MACID[2]<<8)|MACID[3]),(uint16_t)((MACID[4]<<8)|MACID[5]),(uint16_t)((MACID[6]<<8)|MACID[7]));
    }
    /*---------------------------------------------------------------------------*/
    void nbr_lookup_remove(const uip_ipaddr_t *ipaddr)
    {
    uip_ds6_nbr_t *nbr;

    /*
    * check if the address is in lookup table
    * if it is present igrone it otherwise
    * remove from lookup table
    */

    nbr = uip_ds6_nbr_lookup(ipaddr);

    if(nbr != NULL)
    {
    printf("In remove node found");
    nbr_table_remove(ds6_neighbors, nbr);
    }
    }
    /*---------------------------------------------------------------------------*/
    void nbr_lookup_add(const uip_ipaddr_t *ipaddr)
    {
    uip_ds6_nbr_t *nbr;

    /*
    * check if the address is in lookup table
    * if it is present igrone it otherwise
    * add into lookup table
    */

    nbr = uip_ds6_nbr_lookup(ipaddr);

    if(nbr == NULL)
    {
    // printf("neighbour Not found adding to lookup\n");
    uip_lladdr_t *lladdr = (uip_lladdr_t *)uip_ds6_nbr_get_ll(nbr);
    uip_ds6_nbr_add(ipaddr,lladdr,0,NBR_REACHABLE,NBR_TABLE_REASON_IPV6_ND,NULL);
    }
    }
    /*---------------------------------------------------------------------------*/
    static void
    receiver(struct simple_udp_connection *c,
    const uip_ipaddr_t *sender_addr,
    uint16_t sender_port,
    const uip_ipaddr_t *receiver_addr,
    uint16_t receiver_port,
    const uint8_t *data,
    uint16_t datalen)
    {
    // printf("Data received on port %d from port %d with length %d [%s]\n",
    // receiver_port, sender_port, datalen,data);
    char *str ;
    str = (char *) data;
    str[datalen] = '\0';
    int x = 0;

    if(strcmp(str,"SCAN_ACK") == 0)
    {
    PRINT6ADDR(sender_addr);
    PRINTF("\n");
    nbr_lookup_add(sender_addr);
    }
    else if(strcmp(str,"CON#_ACK") == 0)
    {
    PRINT6ADDR(sender_addr);
    PRINTF("OK");
    }
    else
    {
    for(x = 0;x<datalen;x++)
    PRINTF("%c",str[x]);
    }
    //printf("RSSI [%ddBm]\n",(signed short)packetbuf_attr(PACKETBUF_ATTR_RSSI));
    }

    /*---------------------------------------------------------------------------*/
    static void
    print_local_addresses(void)
    {
    int i;
    uint8_t state;

    PRINTF("Node IPv6 addresses: ");
    for(i = 0; i < UIP_DS6_ADDR_NB; i++) {
    state = uip_ds6_if.addr_list[i].state;
    if(state == ADDR_TENTATIVE || state == ADDR_PREFERRED) {
    PRINT6ADDR(&uip_ds6_if.addr_list[i].ipaddr);
    PRINTF("\n");
    /* hack to make address "final" */
    if (state == ADDR_TENTATIVE) {
    uip_ds6_if.addr_list[i].state = ADDR_PREFERRED;
    }
    }
    }
    }

    /*---------------------------------------------------------------------------*/
    PROCESS_THREAD(broadcast_example_process, ev, data)
    {
    uip_ipaddr_t addr;

    PROCESS_BEGIN();

    /** print local adress
    */
    printf("\n Broadcast and Communication process started. \n");
    print_local_addresses();

    /* The data sink runs with a 100% duty cycle in order to ensure high
    packet reception rates. */
    NETSTACK_MAC.off(1);

    /*
    * The serial line Initialise
    */
    uart1_set_input(serial_line_input_byte);
    serial_line_init();

    /*
    * The simple udp connections
    */
    simple_udp_register(&broadcast_connection,UDP_PORT,NULL,UDP_PORT,receiver);

    while(1)
    {
    PROCESS_YIELD();
    if(ev == serial_line_event_message)
    {
    Rcvd_len = serial_data_len;
    serial_data_len = 0;

    // printf("serial-length--[%d]\n",Rcvd_len);
    // Rcvd_len = strlen(data);

    if(strstr(data,"SCAN") != NULL)
    {
    uip_udp_remove(broadcast_connection.udp_conn);
    simple_udp_register(&broadcast_connection,SCAN_PORT,NULL,SCAN_ACK_PORT,receiver);
    // printf("Sening Broadcast\n");
    uip_create_linklocal_allnodes_mcast(&addr);

    simple_udp_sendto(&broadcast_connection, (char *)data+0, Rcvd_len, &addr);
    }
    else if(strstr(data,"MA1#") != NULL)
    {
    /**
    remove the existing connection
    */
    uip_udp_remove(broadcast_connection.udp_conn);

    /**
    Set the MAC Address and Register Peer Node
    */
    memset(Macid,0x00,sizeof(Macid));
    memcpy(Macid,((char*)data)+4,8);
    Mac_Id_Set(Macid);

    simple_udp_register(&broadcast_connection,DATA_TX_PORT,&paired_node_addr,DATA_RX_PORT,receiver);

    simple_udp_sendto(&broadcast_connection,"CON#",4,&paired_node_addr);

    }
    else if(strstr(data,"DIS#") != NULL)
    {
    PRINTF("DISC#--OK");
    }
    else
    {
    // printf("data-->%d\n",Rcvd_len);
    simple_udp_sendto(&broadcast_connection,(char *)data+0,Rcvd_len,&paired_node_addr);
    }
    }
    }
    PROCESS_END();
    }
    /*---------------------------------------------------------------------------*/
  • This is not example code in Contiki. I have no idea how to check it.
  • Dear sir,

    We are using the Chip set CC1310F128RSMR.we have downloaded the latest 6lbr-1.4.x from the Git. In this we modified the example code
    in examples/ipv6/ simple-rpl-udp. In the application we are register the simple-udp connection with call back receiver function.In the receiver call back function we are printing the remote LPR IPV6 Adderess using PRINT6ADDR.if we call this function we are facing this issue.
    please reply.
  • Dear YiKai Chen,

    I used broadcast-example.c example from Contiki (Contiki/examples/ipv6/simple-udp-rpl) and run Run "make CC26XX_NVM=ext TARGET=srf06-cc26xx BOARD=launchpad/cc1310 all" for LAUNCHXL-CC1310 

    I used two Launchpad CC1310 board, after load broadcast-example.hex to both LaunchPad, and run Tera terminal, It's show only "Sending boardcast". Please show me what happen.

  • Do you setup 6lbr?
  • Dear YiKai Chen,

    I used Contiki, not using 6lbr.
  • Do you setup any edge router? If not, two LAUNCHXL-CC1310 cannot communicate to each other.
  • Dear YiKai Chen,

    I only used two LaunchPad, How can I setup an edge router? Please show me the way?
  • Dear YiKai Chen,

    Thanks for your help, so that, one Launchpad we will using 6lbr and download cetic_6lbr_router.bin and another kit will load broadcast-example?
    Thanks,
  • I think you need to have 3 LAUNCHXL-CC1310, one runs cetic_6lbr_router, and anther two run broadcast-example.
  •  Dear YiKai Chen,

    How can I setup chanel in broadcast-example to 25? And I want to ask you why I got 

    "INFO: ENC: resetting chip"

  • You can add "#define RF_CORE_CONF_CHANNEL 25" in project-conf.h of your 6lbr and broadcast-example. As for why you get "INFO: ENC: resetting chip", do you connect ENV28J60 to your LAUNCHXL-CC1310?
  •  Dear YiKai Chen,

    For 6lbr, it run in chanel 25 as image, and I use ENC28J60

  • Can you open web page [bbbb::100] from Firefox?
  • Dear YiKai Chen,

    I used Chrome and still open webpage.

  • It looks running correctly. What's your issue?
  • Dear YiKai Chen,

    Sometime It's show on terminal  "INFO: ENC: resetting chip"

    And I still don't make broadcast-example work in Chanell 25

  • 1. There might be something wrong with latest 6lbr. You can go to /6lbr folder and run "git checkout ff69ae4214407eeec4c71f87589ac4bc7d3a8a49". You will get 6lbr version on 2016 Dec. 22th and you can rebuild 6lbr to test again.
    2. I suggest you to setup sniffer to check if message is sent over the air.
  • @Cuong Do Dinh, I test broadcast-example and I can see it broadcast/receive broadcast message between two LAUNCHXL-CC1310.

  • Dear YiKai Chen,

    Thanks for your help. I will try it. So that we don't need ENC26J80? When we load broadcast example, it's include of mesh function for Launchpad board? Or not?

    How can I use Mesh function for LaunchPad board?

  •  Dear YiKai Chen,

    It's work well with two board using broadcast-example.c as image file I attached, How we can do setup mesh function for Lauchpad board? How we can use  discovery to join network , accept network,... in Contiki?

    Thank so much.

  • Actually, you need ENC26J80. I just don't do a screen shot of my LAUNCHXL-CC1310 with ENC26J80. Mesh function is native supported when you run Contiki 6LowPAN.
  • Dear YiKai Chen,

    How can I to do to run Contiki 6LowPAN? Is it I must use BB Board or Raspi board for this?

    Thank so much for help.
  • You already run it, don't you? broadcast example is one of Contiki 6LowPAN working examples. I would suggest you to include BBB or Raspberry Pi to do more test with Contiki 6LowPAN.
  • Dear YiKai Chen,

    Thank you very much! I will test with BBB and Raspi board.
    Hope you can help.
  • You can refer to sunmaysky.blogspot.tw/.../setup-6lbr-to-run-6lowpan-with-cc2531.html which shows you how to setup 6lbr on Raspberry Pi or BBB to test Contiki 6LowPAN.
  • Dear YiKai Chen,

    Thanks so much. I will follow you.
  • You are welcome.