Replies: 13 comments
-
Thanks for the feedback. It was then a bad idea to re-order the calls. I'll revert the changes |
Beta Was this translation helpful? Give feedback.
-
I'm not entirely sure what the best solution would be here. The RF switch probably won't like it if the chip enters TX mode while RX path is enabled. On the other hand, there is no simple way of waking the chip if the mode is updated before issuing the relevant commands. It seems to me like there are two different states that need to be tracked here, one is the sleep state and the other one is the RF path that will be activated. It might be worth tracking them separately to make sure we don't fry the RF switch. |
Beta Was this translation helpful? Give feedback.
-
I guess that we can revert the ordering for all commands. The change was done because you mentioned that potentially a high power would be applied to a non itialized antenna switch. Actually, I think that this can only happen for a very short time period which shouldn't make a big difference to the antenna switch. It has to be noted that the full RF power is not applied directly, the radio automatically ramps-up the power so, it takes some time to have full RF power applied to the RF output. I would like to propose that we revert back the calls order up until a better way is found. |
Beta Was this translation helpful? Give feedback.
-
I think you are right for the majority of cases. However, the thread could get preempted for some reason between the SPI command and the RF switch update. That could, at least in theory, lead to an arbitrary delay before the switch is configured. |
Beta Was this translation helpful? Give feedback.
-
I see, then for OS operation we could introduce a critical section which would prevent the OS to preempt between the 2 operations. |
Beta Was this translation helpful? Give feedback.
-
I’m not convinced that would work either since many chips use DMA for SPI transactions and that’ll require interrupts to be enabled. |
Beta Was this translation helpful? Give feedback.
-
I'll check with my colleagues who are RF experts what happens if RF power is applied to an antenna switch setup for Rx path. To solve this situation for OS support some of the possible solutions are
In the mean time I will revert the calls ordering. |
Beta Was this translation helpful? Give feedback.
-
1 and 3 are probably not going to work in practice. Changing the hardware is sadly not an option in many cases. Many modules already assume that the switch can be controlled by software and I would like to be able to support them in Zephyr. Preventing OS prevention and at the same time having the ability to perform DMA and take interrupts doesn't seem feasible. In reality, the RF switch might be able to cope with 20dBm for a second or so, so it'll probably not fry the board, so we are probably OK with the old order of maintaining state. I'm not an RF engineer though, so I don't have the experience to judge that. The best long-term solution might be to change the |
Beta Was this translation helpful? Give feedback.
-
Thanks for the feedback. I will try to implement option 2 as soon as possible following your recommendation. When I receive the feedback from my colleagues I'll update this issue. |
Beta Was this translation helpful? Give feedback.
-
Excellent, thanks! |
Beta Was this translation helpful? Give feedback.
-
I got some time to have another look at the HAL today, and it seems like a simple solution might be possible. In fact, the current version (after reverting the change that reordered mode updates) HAL mostly does the right thing to track the RF switch state. My understanding is that the desired behaviour is as follows:
The HAL currently does the following:
Updating the tracker before sending the command seems like it would be legal since you would never come from the sleep state where an explicit wake-up is needed. With the exception of the CW and infinite preamble calls (and potentially RX?), I think this could work. I need to re-test my Zephyr driver though. |
Beta Was this translation helpful? Give feedback.
-
Thanks for the analysis. Once you have finalized your tests would you mind to create a pull-request with required changes? In the long term I think that your proposition to split the antenna control fro the operating mode control would be the most robust solution. As soon as I get some time I'll implement this change. |
Beta Was this translation helpful? Give feedback.
-
We are currently updating all radio drivers to newer versions. @andysan Could you please take a look at v5.0.0-branch in order to confirm that the made changes address your concerns. For further information about the changes that will be introduced for v5.0.0 release please refer to #1239 discussion topic. If you don't mind I convert this issue to a discussion topic. |
Beta Was this translation helpful? Give feedback.
-
I just started to test the commits from #926 and it seems like it had some unintended consequences. Particularly, it seems like 97076b0 causes the radio to be stuck in sleep mode instead of entering RX mode when joining a network.
I haven't debugged this properly, but it seems like this is caused by
SX126xCheckDeviceReady
not realising that it needs to wake the radio.Beta Was this translation helpful? Give feedback.
All reactions