Open dgeppert opened 2 years ago
You are correct. This is a hack to decreases rx to tx switchover time for the CC1101.
When studying Micronet I captured the commands between the MCU and CC1000 in a hull transmitter and found the protocol demanded ~500us switch over time for the first device after the sync packet.
(Small excerpt from the datasheet: The microcontroller uses 3 output pins for the configuration interface (PDATA, PCLK and PALE). PDATA should be a bidirectional pin for data read-back. A bidirectional pin is used for data (DIO) to be transmitted and data received. DCLK providing the data timing should be connected to a microcontroller input. https://www.ti.com/lit/ds/symlink/cc1000.pdf?ts=1662914250311&ref_url=https%253A%252F%252Fwww.ti.com%252Fproduct%252FCC1000)
The CC1101 is slower then the CC1000 at this. If I tried fully idling the radio it'd miss the send window. Since Micronet needs very accurate timing I took that line out. The code still exists in the sender to honor the blocking and idle the radio before sending which is why adding it back worked.
It's a situational issue with no good solution. We either let the sender clobber receives when it needs or miss windows.
thanks for these details, makes it understand better ;-)
some weeks ago I was trying to make esp32Micronet talk to MicronetToNMEA because I had no Micronet devices available. it took me a weekend to figure out why bWorkingBytes was clobber, so the idea was to possibly point this out to others having the some problem.
this weekend I had the first occasion to test esp32Micronet with a real Micronet system, just works like a charm!
many thanks for sharing your work so others might profit and have some fun with it as well! ;-)
problem:
rRadio->bWorkingBytes
is global class variable, may get overwrittenISRDataIn
which fires at high frequency because CC1101 not configured to use SYNC_WORD, the esp32Micronet radio driver checks all for preamble and sync word etc.Radio::OutgoingPacketHandler(void *r)
checks for radio state:if (rRadio->eRadioState != RS_IDLE) rRadio->Stop();
: we are in RS_IDLE BUT should be in RS_TX as we are in stateListen()
solution:
Radio::Listen()
eInputState = IS_WAIT;
eRadioState = RS_RX;
// <--- added this here and problem solved, first four bytes ofbWorkingBytes
no longer overwritten!!!