send data from gateway to waspmote 868

Everything about programming the platform and using the Waspmote API
Post Reply
rr4v
Posts: 99
Joined: Fri Jun 14, 2013 1:50 am

send data from gateway to waspmote 868

Post by rr4v » Sun Jul 28, 2013 11:58 pm

I would like to set the time of a remote waspmote by sending a string from a PC with a usb gateway. Is this possible? How should I do that? What is the default behavior of the gateway when it receives data from USB? And how should I program the waspmote to read the string?

Thanks in advance

libelium-dev
Posts: 27967
Joined: Mon Sep 28, 2009 1:06 pm

Re: send data from gateway to waspmote 868

Post by libelium-dev » Wed Jul 31, 2013 4:55 pm

rr4v,

The USB gateway is just an Xbee module + an UART-to-USB converter.

Then, the easiest way to send data to a Waspmote from the gateway, is to use the XBee module in transparent mode, configuring it to send data to Waspmote (parameters DH and DL, and AP=0)

then, all you send by the USB (a COM port which can be managed by a serial monitor like the one on Waspmote IDE, hyperterminal, etc.) will be sent directly to the Xbee plugged into the Waspmote, so the code on the Waspmote is listening and saving the data properly.

The other way is making an script to send data, and also you can use XBee modules in AP2 (as Wasp) building all the frame with headers, etc. take a look on this tool.

http://ftp1.digi.com/support/utilities/ ... frames.htm


regards.

rr4v
Posts: 99
Joined: Fri Jun 14, 2013 1:50 am

Re: send data from gateway to waspmote 868

Post by rr4v » Thu Aug 01, 2013 11:38 am

So, by default, the xbee in the gateway is not configured in transparent mode? Which mode is it configured by default? Can I change configuration of the xbee using the gateway or do I need to extract the xbee module and place it in a programmer?

libelium-dev
Posts: 27967
Joined: Mon Sep 28, 2009 1:06 pm

Re: send data from gateway to waspmote 868

Post by libelium-dev » Fri Aug 02, 2013 9:25 am

rr4v,

Libelium uses AP2 and BD7 paramenters, which are set before selling. but if you restore by factory default with Xctu tool, AP will be 0 and BD will be 3.

anyway, you can change it whenever you need.

rr4v
Posts: 99
Joined: Fri Jun 14, 2013 1:50 am

Re: send data from gateway to waspmote 868

Post by rr4v » Fri Aug 16, 2013 2:38 am

So, now that I configured the gateway with AP=0 I guess any string I type in the serial monitor is sent, is is right? what destination is send to? is a kind of broadcast sent? what is the next step? should I change the xbee configuration in the remote waspmotes too? How do I read these strings in the remote waspmotes? is there any function in the api that I could use to read any data available in the xbee868 even if the data is not a frame or packet?

libelium-dev
Posts: 27967
Joined: Mon Sep 28, 2009 1:06 pm

Re: send data from gateway to waspmote 868

Post by libelium-dev » Mon Aug 19, 2013 9:57 am

rr4v,

With API=0, all data typed in serial monitor will be sent.

Regarding the destination address, you have to set it in the DH and DL fields (with corresponding AT commands or with X-CTU). If you set it to 0000FFFF it will be broadcast.

See Digi's doc to know more about this. http://www.digi.com/products/wireless-w ... o-868#docs

You can manage the serial port with the functions serialAvailable, serialRead, etc in the same way of Arduino. In the Waspmote API they are fully used, you can take a look in many libraries to see how to use them.

regards

jburgues
Posts: 25
Joined: Tue Jul 23, 2019 10:47 am
Company: IBEC

Re: send data from gateway to waspmote 868

Post by jburgues » Wed Oct 23, 2019 1:25 am

Hello,

I have the same problem as rr4v: I want to send a command from my Windows PC to the waspMote and also receive frames from the waspMote in the PC.

If I understood properly, the only thing I have to do is to change AP mode from 2 to 0 in the USB gateway using XCTU tool (DH-DL currently are 0x0000FFFF for broadcast, so I may leave that unchanged).

Is there any recommended procedure to change the AP mode minimizing any potential harm to the USB gateway?

Then, assuming the AP mode has been changed properly, I want to send a command to the waspMote. Do I just type it as a string in the serial monitor of my PC and the waspMote will receive that string in its serial interface? In which one: USB, UART1, UART2?

To read such command, something as simple as this should work?:

if (serialAvailable(1)) {
uart.readBuffer(EXAMPLE_UART_SIZE);
}

Then, to send a frame FROM the waspMote TO the gateway, shall I keep doing it in the same way as shown in 868LP_08a_complete_example_send? Or shall I change the way I send frames to the PC when the USB gateway AP mode is set to 0?

Thanks a lot!
Javier.

libelium-dev
Posts: 27967
Joined: Mon Sep 28, 2009 1:06 pm

Re: send data from gateway to waspmote 868

Post by libelium-dev » Wed Oct 23, 2019 9:38 am

Hi,

If you change the API mode of the node connected to the gateway to 0, all data sent from the serial terminal to the node will be sent through the module. The data received will be also shown through the serial monitor. You can change the configuration using the X-CTU tool.

Opening the serial interface where the gateway is connected you can send data and it should be received in waspmote.

In waspmote, you have to use the functions to send or receive data.
http://www.libelium.com/development/was ... bcat=868lp

You can also keep the API mode to 2 and send/receive data using XCTU tool or you can do your own to develop to send the proper commands to the module to send/receive data.

Regards

jburgues
Posts: 25
Joined: Tue Jul 23, 2019 10:47 am
Company: IBEC

Re: send data from gateway to waspmote 868

Post by jburgues » Wed Oct 23, 2019 12:25 pm

If I got it properly, I can send commands to my waspMote with a USB gateway configured with AP=2, provided the frames are formatted according to the API frame format of DIGI:
https://www.digi.com/resources/document ... _900hp.htm

Taking as reference this example (https://www.digi.com/resources/document ... e%7C_____4), I want to send the string "Hello" to my waspMote with address 0x0013A200416430F7.

For that, I first create the frame :
'7E 00 7D 33 10 01 00 7D 33 A2 00 41 64 30 F7 FF FE 00 00 48 65 6C 6C 6F 7C'

where '7E' is the Start Delimiter, '00 7D 33' is the Frame Length (after escaping 0x13 with 0x7D33), '10' is the Frame Type (Transmit Request frame), '01' is the Frame ID, '00 7D 33 A2 00 41 64 30 F7' is my waspMote address (after escaping 0x13 with 0x7D33), 'FF FE' is the 16-bit Destination address (0xFFFE = broadcast), '00' is the Broadcast Radius, '00' is the Options field, '48 65 6C 6C 6F' is the string "Hello" and '7C' is the checksum.

0x11, 0x13, 0x7D and 0x7E characters have been escaped.

Then, I configure the serial terminal of my Window PC at 115200 baud rate and LF terminator, and send the above frame.

However, I do not receive anything at the waspMote running the example code _868LP_08b_complete_example_receive. If I place a debug print inside function WaspXBeeCore::receivePacketTimeout( uint32_t timeout) of WaspXBeeCore.cpp:

// Read char
if( available() )
{
c = serialRead(uart);
USB.print(F("Serial data received: "));
USB.println(c, DEC);

....
}

The print is never executed because the available() function never becomes true.

Any idea what is going on?

Thanks,.
Javier.

libelium-dev
Posts: 27967
Joined: Mon Sep 28, 2009 1:06 pm

Re: send data from gateway to waspmote 868

Post by libelium-dev » Thu Oct 24, 2019 11:39 am

Hi,

Did you configure the same PANID and channel mask in both modules? You can use that example
http://www.libelium.com/development/was ... arameters/

Is the packet send while the Waspmore is executing the receive function?

In addition, please try to send the data from XCTU to make sure that it is created properly.

Regards

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest