contiki-os/contiki

Cooja serial communication from test script to nodes

Opened this issue · 0 comments

I am trying to send data (or rather commands) from the Cooja test script, to the firmware in the simulated nodes.

Node type: ContikiMote

Here is the mote type definition:

    <motetype>
      org.contikios.cooja.contikimote.ContikiMoteType
      <identifier>mtype345</identifier>
      <description>root node</description>
      <source>[CONFIG_DIR]/code/root.c</source>
      <commands>make root.cooja TARGET=cooja</commands>
      <moteinterface>org.contikios.cooja.interfaces.Position</moteinterface>
      <moteinterface>org.contikios.cooja.interfaces.Battery</moteinterface>
      <moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiVib</moteinterface>
      <moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiMoteID</moteinterface>
      <moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiRS232</moteinterface>
      <moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiBeeper</moteinterface>
      <moteinterface>org.contikios.cooja.interfaces.RimeAddress</moteinterface>
      <moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiIPAddress</moteinterface>
      <moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiRadio</moteinterface>
      <moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiButton</moteinterface>
      <moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiPIR</moteinterface>
      <moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiClock</moteinterface>
      <moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiLED</moteinterface>
      <moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiCFS</moteinterface>
      <moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiEEPROM</moteinterface>
      <moteinterface>org.contikios.cooja.interfaces.Mote2MoteRelations</moteinterface>
      <moteinterface>org.contikios.cooja.interfaces.MoteAttributes</moteinterface>
      <symbols>false</symbols>
    </motetype>

I have implemented (copied) the serial-line.[ch] files into my project, they build fine. I call the init function, and I understand that I need to connect the actual input of characters into the serial-line module with a callback.

Here is what I am missing: what is this input interface? I've seen someone suggesting using uart0, but I cannot find uart0_set_input() for ContikiMotes. I cannot find how to setup baudrate for that interface either.

I've tried with Cooja platform's rs232 (copied a bunch of files such as rs232.[ch], simEnvChange.[ch]), with no success (tried all the defined speeds):

    rs232_init();
    rs232_set_speed(RS232_19200);
    rs232_set_input(serial_line_input_byte);
    serial_line_init();

How do I connect and setup a ContikiMote serial input interface to the serial-input module, in the node's code?