diff --git a/configs/b-l475e-iot01a/README.txt b/configs/b-l475e-iot01a/README.txt index 1880831f36..dc3c0cfd06 100644 --- a/configs/b-l475e-iot01a/README.txt +++ b/configs/b-l475e-iot01a/README.txt @@ -520,7 +520,11 @@ Configuration sub-directories might be a work around... it is not. Still RX FIFO errors. From my reading, the only known work-around is to reduce the maximum packet size so that it is smaller than 96. I tried setting the maximum packet - length to 84 and that did NOT eliminate the RX FIFO error anyway. + length to 84 and that did NOT eliminate the RX FIFO error. + + At the end of the TCP test, the "nsh> ifconfig" command shows that + there were two TX timeouts. Perhaps this is related? The TX timeout + is set to 5 seconds, so this could be a serious performance issue. So for now I have to live with the RX FIFO error. I have observed only a single RX FIFO error and it occurs at the same place in the @@ -537,4 +541,5 @@ Configuration sub-directories the payload correctly from RX FIFO." Reducing the FIFO to 94 bytes fixed the problem with the 2 byte CRC - but did not resolve that occasional, harmless RX FIFO error. \ No newline at end of file + but did not resolve that occasional RX FIFO error. + diff --git a/drivers/wireless/spirit/drivers/Kconfig b/drivers/wireless/spirit/drivers/Kconfig index 16d611b8ab..67c7726de3 100644 --- a/drivers/wireless/spirit/drivers/Kconfig +++ b/drivers/wireless/spirit/drivers/Kconfig @@ -31,6 +31,9 @@ config SPIRIT_PKTLEN This can be avoided by reducing the maximum packet length to a value which is lower than the RX FIFO size." + Also, with a packet size of 96, I have seen CRC failures on the receiving + side. With a packet size of 94, CRC filtering behaves well. + config SPIRIT_FIFOS bool "FIFO Watermarks" default n diff --git a/net/sixlowpan/sixlowpan_utils.c b/net/sixlowpan/sixlowpan_utils.c index 0765dd4ff1..5da752882d 100644 --- a/net/sixlowpan/sixlowpan_utils.c +++ b/net/sixlowpan/sixlowpan_utils.c @@ -4,9 +4,6 @@ * Copyright (C) 2017 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * - * Copyright (C) 2017, Gregory Nutt, all rights reserved - * Author: Gregory Nutt - * * Derives from logic in Contiki: * * Copyright (c) 2008, Swedish Institute of Computer Science. @@ -177,6 +174,8 @@ static void sixlowpan_eaddrfromip(const net_ipv6addr_t ipaddr, FAR uint8_t *eadd * * 128 112 96 80 64 48 32 16 * ---- ---- ---- ---- ---- ---- ---- ---- + * ff02 xxxx xxxx xxxx xxxx xxxx xxxx xxxx Multicast + * ff02 0000 0000 0000 0000 0000 0000 0001 All nodes multicast group * xxxx 0000 0000 0000 0000 00ff fe00 xx00 1-byte short address IEEE 48-bit MAC * xxxx 0000 0000 0000 0000 00ff fe00 xxxx 2-byte short address IEEE 48-bit MAC * xxxx 0000 0000 0000 xxxx xxxx xxxx xxxx 8-byte extended address IEEE EUI-64 @@ -191,10 +190,10 @@ int sixlowpan_destaddrfromip(FAR struct sixlowpan_driver_s *radio, const net_ipv6addr_t ipaddr, FAR struct netdev_varaddr_s *destaddr) { -#ifdef CONFIG_NET_STARPOINT struct sixlowpan_properties_s properties; int ret; +#ifdef CONFIG_NET_STARPOINT /* Only the radio driver knows the correct address of the hub. For IEEE * 802.15.4 this will be the address of the PAN coordinator. For other * radios, this may be some configured, "well-known" address. @@ -212,6 +211,44 @@ int sixlowpan_destaddrfromip(FAR struct sixlowpan_driver_s *radio, #else /* CONFIG_NET_STARPOINT */ + /* Check for a multicast address */ + + if (ipaddr[0] == HTONS(0xff02)) + { + DEBUGASSERT(radio->r_properties != NULL); + ret = radio->r_properties(radio, &properties); + if (ret < 0) + { + return ret; + } + + /* Check for the broadcast IP address + * + * IPv6 does not implement the method of broadcast, and therefore + * does not define broadcast addresses. Instead, IPv6 uses multicast + * addressing to the all-nodes multicast group: ff02:0:0:0:0:0:0:1. + * + * However, the use of the all-nodes group is not common, and most + * IPv6 protocols use a dedicated link-local multicast group to avoid + * disturbing every interface in the network. + */ + + if (ipaddr[1] == 0 && ipaddr[2] == 0 && ipaddr[3] == 0 && + ipaddr[4] == 0 && ipaddr[5] == 0 && ipaddr[5] == 0 && + ipaddr[7] == HTONS(0x0001)) + { + memcpy(destaddr, &properties.sp_bcast, + sizeof(struct netdev_varaddr_s)); + } + else + { + memcpy(destaddr, &properties.sp_mcast, + sizeof(struct netdev_varaddr_s)); + } + + return OK; + } + /* Otherwise, the destination MAC address is encoded in the IP address */ /* Check for compressible link-local address. @@ -238,9 +275,6 @@ int sixlowpan_destaddrfromip(FAR struct sixlowpan_driver_s *radio, if (radio->r_dev.d_lltype == NET_LL_PKTRADIO) #endif { - struct sixlowpan_properties_s properties; - int ret; - DEBUGASSERT(radio->r_properties != NULL); ret = radio->r_properties(radio, &properties); if (ret < 0) diff --git a/wireless/ieee802154/mac802154_loopback.c b/wireless/ieee802154/mac802154_loopback.c index 2ea9865a06..054cfb390b 100644 --- a/wireless/ieee802154/mac802154_loopback.c +++ b/wireless/ieee802154/mac802154_loopback.c @@ -918,14 +918,17 @@ static int lo_properties(FAR struct sixlowpan_driver_s *netdev, /* Multicast address (uses broadcast address) * - * Multicast address should really determined by the first 3 bits - * (RFC 4944): + * For meshes (only) a multicast address candetermined by the first 3 bits + * of a short address (RFC 4944): * - * 0xxxxxxx xxxxxxxx: Unicast address - * 100xxxxx xxxxxxxx: Multicast address - * 101xxxxx xxxxxxxx: Reserved - * 110xxxxx xxxxxxxx: Reserved - * 111xxxxx xxxxxxxx: Reserved + * 0xxxxxxx xxxxxxxx: Unicast address + * 100xxxxx xxxxxxxx: Multicast address + * 101xxxxx xxxxxxxx: Reserved + * 110xxxxx xxxxxxxx: Reserved + * 111xxxxx xxxxxxxx: Reserved + * + * Otherwise, Multicast is implemented with the broadcast address + * (qualified by the destination PANID). */ properties->sp_mcast.nv_addrlen = NET_6LOWPAN_SADDRSIZE; diff --git a/wireless/ieee802154/mac802154_netdev.c b/wireless/ieee802154/mac802154_netdev.c index 611c85e611..1a16883203 100644 --- a/wireless/ieee802154/mac802154_netdev.c +++ b/wireless/ieee802154/mac802154_netdev.c @@ -1068,14 +1068,17 @@ static int macnet_properties(FAR struct sixlowpan_driver_s *netdev, /* Multicast address (uses broadcast address) * - * Multicast address should really determined by the first 3 bits - * (RFC 4944): + * For meshes (only) a multicast address candetermined by the first 3 bits + * of a short address (RFC 4944): * - * 0xxxxxxx xxxxxxxx: Unicast address - * 100xxxxx xxxxxxxx: Multicast address - * 101xxxxx xxxxxxxx: Reserved - * 110xxxxx xxxxxxxx: Reserved - * 111xxxxx xxxxxxxx: Reserved + * 0xxxxxxx xxxxxxxx: Unicast address + * 100xxxxx xxxxxxxx: Multicast address + * 101xxxxx xxxxxxxx: Reserved + * 110xxxxx xxxxxxxx: Reserved + * 111xxxxx xxxxxxxx: Reserved + * + * Otherwise, Multicast is implemented with the broadcast address + * (qualified by the destination PANID). */ properties->sp_mcast.nv_addrlen = NET_6LOWPAN_SADDRSIZE;