Receiving data

Home Forums mDot/xDot Receiving data

Tagged: 

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #10756
    Anthony Huy
    Participant

    How do I received data from the Conduit to the mDot. I’m using the mDotLib from mbed. I send data and then call “recv”. On the conduit side, I’m add data to the MQTT server, which i think works as I’m able to subscribe to that “up” channel and see it added. However, on the mDot side, when i call “recv” i get back an error of -5, MDOT TIMEOUT.

    Do you have any sample code for this? Again, I’m NOT using the AT command but the mbed library. Thanks

    #10758
    Mike Fiore
    Blocked

    Anthony,
    Take a look at this page on the developer site:

    http://www.multitech.net/developer/software/lora/conduit-mlinux-lora-communication/

    It has examples of sending and receiving packets to and from the mDot and an example node.js application.

    Cheers,
    Mike

    #10945
    Howard Bray
    Participant

    I’m also having trouble at the mDot end using the mBed library. The linked page (above) is great from the conduit PoV but it’s the mDot end I can’t receive. Tx is OK. I cannot find any examples of code that use the library, only examples using the AT terminal.

    PS I’ve just come across: https://developer.mbed.org/teams/MultiTech/code/mDot_LoRa_Connect_Example/

    Very helpful, just hard to find.

    #10961
    Mike Fiore
    Blocked

    Howard,
    All of our mDot library examples are linked to from our mDot platform page on mbed:

    https://developer.mbed.org/platforms/MTS-mDot-F411/

    Cheers,
    Mike

    #11001
    Howard Bray
    Participant

    Hi Mike

    Yep, the Connect example explains a lot and I’m now finding my Conduit, setting parameters, connecting to network and sending stuff. The Node-RED is an excellent testing tool.
    Is there an example of receiving strings on the mDot? I’m having lots of trouble as it seems that there are timing factors that I’m not aware of.

    The in on https://developer.mbed.org/questions/61950/Receive-data/ is helpful, but a 5 line example might clear up everyone’s misunderstanding.

    I’m getting back an MDOT_OK but length is 0.

    There’s some important factor that I’m missing here …

    many thanks again.

    • This reply was modified 8 years, 3 months ago by Howard Bray.
    • This reply was modified 8 years, 3 months ago by Howard Bray.
    • This reply was modified 8 years, 3 months ago by Howard Bray.
    • This reply was modified 8 years, 3 months ago by Howard Bray.
    • This reply was modified 8 years, 3 months ago by Howard Bray.
    #11009
    Jason Reiss
    Keymaster

    Howard,

    Did you send a packet to the Conduit?

    The mDot will only be able to receive a packet after a successful send.

    #11030
    Howard Bray
    Participant

    Hi Jason

    Sure did. I have a small test program that sends a ‘*’ to the conduit every 10 seconds and checks the receiver after a 500mS delay (not a blocking wait). If I do nothing, I see the ‘*’ at the conduit (love the Node-RED!) and my loop reports No Packet Received. If I send something from the Conduit, my loop reports that the receiver got something after the next send, but the length is zero.

    thanks

    -H

    #11031
    Jason Reiss
    Keymaster

    The packets sent down to mDot are during two receive windows at 1 and 2 seconds after end of transmission.

    #11032
    Howard Bray
    Participant

    Hi Jason

    Just prior to your response, I saw the mention of the receive windows. Probably as you were writing your post, I was changing my test to wait 5 secs before asking the receiver. Same result – the receiver says something has come in, but length is zero.

    —————
    else
    {
    pc.printf(“successfully sent data to gateway\n”);
    }

    data_str.clear();
    osDelay(5000);

    if ((ret = dot->recv(data)) != mDot::MDOT_OK)
    {
    pc.printf(“failed to get – %ld: %s, %s\n”, ret, mDot::getReturnCodeString(ret).c_str(), dot->getLastError().c_str());
    }
    else
    {
    pc.printf(“revc says something from gateway\n”);
    if (data_str.length() > 0)
    {
    for (std::string::iterator it = data_str.begin(); it != data_str.end(); it++)
    {
    data.push_back((char) *it); // return it from binary to character
    }

    pc.printf(“successfully got data from gateway : %s (%d)\n”, data_str.c_str(),data_str.length());
    }
    }

    #11033
    Jason Reiss
    Keymaster

    When is data_str being filled?
    I don’t believe data_str.length() will ever be > 0.

    Shouldn’t you check ‘data.length()’ and iterate over ‘data’ calling push_back on ‘data_str’?

    #11034
    Howard Bray
    Participant

    I think we’re zeroing in on the problem. My understanding is that the data_str is filled by the receiver as it’s referenced by the vector ‘data’ passed to recv(). Basically the same as the send but in reverse.

    If I could find an example of the mechanics of this, it would be a great help.

    #11035
    Howard Bray
    Participant

    I have just found https://developer.mbed.org/users/mfiore/code/mDot_test_rx/
    I found it as a link on Mike Fiore’s page. So much useful information, if only it compiled. There’s a problem with no overloaded function bin2hexString matching the call.

    I’m puzzled as to why it’s so hard to find a working example of receiving data on an mDot. I know I’m not the only one asking, but no one has an answer.

    • This reply was modified 8 years, 3 months ago by Howard Bray.
    • This reply was modified 8 years, 3 months ago by Howard Bray.
Viewing 12 posts - 1 through 12 (of 12 total)
  • You must be logged in to reply to this topic.