|
| 1 | +Transmit Data IPv6 Sample Application |
| 2 | +===================================== |
| 3 | + |
| 4 | +This example demonstrates the usage of the socket IPv6 API by giving an example |
| 5 | +of how to transmit data to other XBee device in the same Wi-SUN network. |
| 6 | + |
| 7 | +Requirements |
| 8 | +------------ |
| 9 | + |
| 10 | +To run this example you need: |
| 11 | + |
| 12 | +* Two XBee Wi-SUN module. |
| 13 | +* Two carrier board for the radio module (XBIB-U-DEV or XBIB-C board). |
| 14 | +* One Wi-SUN border router. |
| 15 | +* Digi XBee Studio v1.2.0 or higher (available at www.digi.com/xbee-studio). |
| 16 | + |
| 17 | +Setup |
| 18 | +----- |
| 19 | + |
| 20 | +The XBee module that runs this sample will act as sender, while the other |
| 21 | +one will act as receiver. |
| 22 | + |
| 23 | +Make sure the hardware is set up correctly: |
| 24 | + |
| 25 | +1. Plug the XBee radio module into the XBee adapter and connect it to your |
| 26 | + computer's USB port. |
| 27 | +2. Ensure that the receiver module is in API mode and both modules are on the |
| 28 | + same Wi-SUN network. |
| 29 | +3. Find the IPv6 address of the receiver module in XBee Studio. It will be used |
| 30 | + later in the example. |
| 31 | + |
| 32 | +Run |
| 33 | +--- |
| 34 | + |
| 35 | +Before launching the application, you need to set up XBee Studio to see the data |
| 36 | +received by the receiver module. Follow these steps to do so: |
| 37 | + |
| 38 | +1. Launch XBee Studio. |
| 39 | +2. Wait until the receiver XBee module is discovered and click on it. |
| 40 | +3. In the left menu, go to the **XBee Console** page and open the connection. |
| 41 | +4. Create and add an API frame to the **Send data** list with the following |
| 42 | + parameters: |
| 43 | + |
| 44 | + - Frame type: 0x40 - Socket Create |
| 45 | + - Frame ID: 01 |
| 46 | + - Protocol: UDP [00] |
| 47 | + |
| 48 | +5. Send this packet by selecting it and clicking the **Send selected packet** |
| 49 | + button. Click the received *Socket Create Response* packet and look for the |
| 50 | + assigned *Socket ID*. |
| 51 | +6. Create another API frame with the following parameters: |
| 52 | + |
| 53 | + - Frame type: 0x46 - Socket Bind/Listen |
| 54 | + - Frame ID: 02 |
| 55 | + - Socket ID: Use the ID received in the previous packet |
| 56 | + - Source port: 12 34 |
| 57 | + |
| 58 | +7. Send this packet by selecting it and clicking the **Send selected packet** |
| 59 | + button. |
| 60 | + |
| 61 | +Fill the **TARGET_IPV6_ADDR** constant in the MicroPython application with the |
| 62 | +IPv6 address of the receiver module. Finally, compile and launch the MicroPython |
| 63 | +application. It prints out the status of the operation in the console: |
| 64 | + |
| 65 | + Sending data to XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX >> Hello, Wi-SUN module! |
| 66 | + Data sent successfully |
| 67 | + |
| 68 | +Verify that a new **Socket Receive From: IPv6** packet has been received in the |
| 69 | +XBee Studio console. Select it and review the details, some of them similar to: |
| 70 | + |
| 71 | + - Frame type: CB (Socket Receive From: IPv6) |
| 72 | + - Source address: The XBee sender's IPv6 address |
| 73 | + - Payload data (ASCII): Hello, Wi-SUN module! |
| 74 | + |
| 75 | +Supported platforms |
| 76 | +------------------- |
| 77 | + |
| 78 | +* Digi XBee Wi-SUN - minimum firmware version: B000 |
| 79 | + |
| 80 | +License |
| 81 | +------- |
| 82 | + |
| 83 | +Copyright (c) 2025, Digi International, Inc. |
| 84 | + |
| 85 | +Permission is hereby granted, free of charge, to any person obtaining a copy |
| 86 | +of this software and associated documentation files (the "Software"), to deal |
| 87 | +in the Software without restriction, including without limitation the rights |
| 88 | +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 89 | +copies of the Software, and to permit persons to whom the Software is |
| 90 | +furnished to do so, subject to the following conditions: |
| 91 | + |
| 92 | +The above copyright notice and this permission notice shall be included in all |
| 93 | +copies or substantial portions of the Software. |
| 94 | + |
| 95 | +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 96 | +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 97 | +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 98 | +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 99 | +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 100 | +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 101 | +SOFTWARE. |
0 commit comments