energia / EasyLink

EasyLink library for the CC1310 LaunchPad
15 stars 2 forks source link

RX Filtering Addresses #9

Open rei-vilo opened 6 years ago

rei-vilo commented 6 years ago

The idea is the concentrator sends a message to a specific node based on its MAC 15.4 address.

The example provided for the CC1310 and CC1350 set the destination address to 0xaa.

    // Set the destination address to 0xaa
    txPacket.dstAddr[0] = 0xaa;

The rfEasyLinkRx Example provides the explanations about the destination address 0xaa.

If RFEASYLINKRX_ADDR_FILTER is defined (as it is by default) then the RX Address filter will be enabled for address 0xaa. This will cause the rfEasyLinkRx to only accept packets with a destination address of 0xaa, which the rfEasyLinkTx example transmits. When using the rfEasyLinkTx example there will be no difference in behavior when defining/undefining RFEASYLINKRX_ADDR_FILTER as the rfEasyLinkTx example will use a destination address of 0xaa. However if transmitting from another source like SmartRF Studio and not using an address of 0xaa then defining RFEASYLINKRX_ADDR_FILTER will result in packets not being received.

The EasyLink API reference details the destination address is 64-bit long, perfect to match the MAC 15.4 address FCFG1_O_MAC_15_4_0 and FCFG1_O_MAC_15_4_1.

uint8_t EasyLink_TxPacket::dstAddr[8]

Destination address.

However, the EasyLink Sub-1 GHz communication library reference page at Energia.nu does not mention this option.

How to implement it?

rei-vilo commented 6 years ago

The Anaren CC110L library had the hardware message filtering implemented.

  /**
   *  begin - setup the SPI peripheral and I/O, GDO0 interrupt I/O, and
   *  initialize the radio session.
   *
   *    @param  address   Default device address used for hardware message 
   *                      filtering.
   *    @param  channel   Default frequency to receive/transmit on.
   *    @param  power     Default output power level to transmit at.
   */
  static void begin(uint8_t address, channel_t channel, power_t power);

  /**
   *  setAddress - set device address. This address is used for hardware message
   *  filtering. If a message is received but does not match the device address
   *  and is not a broadcast (message sent to broadcast address 0x00), the 
   *  message is automatically discarded; the radio driver is never notified.
   *
   *    @param  address   The device address of the receiving node.
   */
  static void setAddress(uint8_t address);
  /**
   *  transmit - build a data stream from the data field provided and transmit
   *  the resulting message over-the-air to a specified address.
   *
   *    @param  address     The device address of the receiving node. This 
   *                        address may go to a broadcast address (0x00).
   *    @param  dataField   Payload for the data stream.
   *    @param  length      Number of bytes in the data field buffer.
   */
  static void transmit(uint8_t address, uint8_t *dataField, uint8_t length);
rei-vilo commented 6 years ago

See examples at CC1310: Does EasyLink_enableRxAddrFilter() filter on the destination address or the source address? and CC1310: EasyLink_enableRxAddrFilter not filtering on E2E forum.

Calling the dedicated function from EasyLink.c is possible, but integrating those features into the EasyLink object would be really nice.

rei-vilo commented 6 years ago

Based on the documentation provided by TI and help from E2E forum, I managed to implement address management. Actually, addresses are managed by the receiving radios which filter incoming messages.

How to proceed? Should I implement a separate library or update the EasyLink library?

rei-vilo commented 6 years ago

Title has been changed from Setting Destination Addresses to RX Filtering Addresses to reflect the underlying technology used by sub-1 GHz.