osresearch / micropython

MicroPython - a lean and efficient Python implementation for microcontrollers and constrained systems
https://micropython.org
MIT License
31 stars 8 forks source link

Radio.tx() stopped working #4

Closed osresearch closed 4 years ago

osresearch commented 4 years ago

While trying to debug auto-ack with IEEE802154 I changed the rxTransition to go into TX, thinking that maybe would go into TX after a successful RX to send the ACK. DO NOT APPLY THIS PATCH:

diff --git a/ports/efm32/radio.c b/ports/efm32/radio.c
index a92dc117d..383f884b6 100644
--- a/ports/efm32/radio.c
+++ b/ports/efm32/radio.c
@@ -63,7 +63,7 @@ static const RAIL_IEEE802154_Config_t ieee802154_config = {
                .enable                 = true,
                .ackTimeout             = 54 * 16, // 54 symbols * 16 us/symbol = 864 usec
                .rxTransitions = {
-                       .success = RAIL_RF_STATE_RX, // go to Tx to send the ACK
+                       .success = RAIL_RF_STATE_TX, // go to Tx to send the ACK
                        .error = RAIL_RF_STATE_RX, // ignored
                },
                .txTransitions = {

It didn't work, but when I switched it back the radio seems to no longer be able to TX. My packet sniffer does not see any outbound packets from the radio, even after doing a full power off and reflash. I tried rolling back to the last known good and it still is unable to transmit.

osresearch commented 4 years ago

Or maybe something else is broken. I can't seem to transmit from several of the devices now, although going back to a remote with a much older firmware and I can tx without problems.

osresearch commented 4 years ago

Good news: it doesn't brick the radio. Rolling back to 479663832f9781426dd8fd57dca174a8ed798187 restored radio tx functionality. It appears the break happened between then and ed65e3315c20266a95a2b133c49e4fdaee1cc44b. I'm bisecting to see what's up: https://github.com/osresearch/micropython/compare/479663832f9781426dd8fd57dca174a8ed798187..ed65e3315c20266a95a2b133c49e4fdaee1cc44b

osresearch commented 4 years ago

The problem appears to be isolated to the replacement RAIL library ../../$(GECKO_SDK)/protocol/bluetooth/lib/$(EFM_FAMILY_UC)/GCC/librail.a in place of the rail/TARGET_EFR32_1/librail_efr32xg1_release.a that was used before.

It does say "bluetooth" in the directory name... I'm opening an issue with efm32-base to see if they have any ideas.

osresearch commented 4 years ago

Added the issue with efm32-base: https://github.com/ryankurte/efm32-base/issues/21

osresearch commented 4 years ago

Rolling back entirely to the 2.3.0 RAIL library from https://github.com/ARMmbed/mbed-os/tree/master/targets/TARGET_Silicon_Labs/TARGET_SL_RAIL/efr32-rf-driver/rail seems to fix all of my TX related problems.

osresearch commented 4 years ago

I've re-imported the 2.3.1 rail library and updated the makefile and board files. https://github.com/osresearch/micropython/commit/237d9a67c888d1c5e96b207dc38058abc51d52f2