Since about two weeks I’m working on sx128x driver that will meet my requirements. My sdk is NRF Connect SDK(zephyr rtos) and nrf52833 cpu. We are going to replace radio module that we currently use with sx1281 and LoRa modulation.
I based my implementation on SX1280_DemoApp but I have provided neccessary changes. My first goal is to create ping-pong application. Most of things work well but I can see some missanderstanding.
That’s are requirements to radio api that I need to meet:
- device need to send async meseges with no delay
- device has to be able to answer on query asap with option that answer can be on different channel(different frequency)
- maximum time of ping-pong(query) transaction has to be ~100ms
- device has to be able to query another device on frequency X and get answer on frequency Y
First thing that I have changed in SX1280_DemoApp is working mode, RX_TX_CONTINUOUS is mouch more suitable for my requirements. One another thing is paylod mode, LORA_PACKET_FIXED_LENGTH is selected in my implementation. Also I had to make driver to be suitable to work with RTOS.
My observations and obstacles:
- Take a look on simple ping-pong transaction. Like I mentioned before, one of my requirements is that device should be able to answer on query on different frequency that received query.
a. DEVICE_A sending PING message to DEVICE_B on frequency X and waiting for send complete event
b. DEVICE_A switching to frequency Y and waiting for answer
c. DEVICE_B receivnig PING message on frequency X
d. DEVICE_B switching to frequency Y and sending PONG message to DEVICE_A also waiting for send complete event
e. DEVICE_B switching to frequency X
f. DEVICE_A receiving PONG message and back to frequency X
Time of transaction is measured on device A and is equal to (ts_done - ts_start).
To make it working I need to add delay_ms(>5) between steps © and (d). When I’m not switching between frequencies everything work perfect with no delay in this algorithm.
Did I missed something here? Is there some specific time of switching between frequencies, or some information inside module that I have to check to know that new frequency is stable?
- Second thing is CRC checking. I’m subsribed on crc error irq, but it has never been notified even if data been corrupted(I added my own crc to payload so I know that data been corrupted). After receving data I read PacketStatus but most of time ErrCrc is selected even if data are valid… Some bad configuration can be the reason of this behaviour?
Currently those two questions are the most important for my design
Is it possible to upload source code here… In some human readable format?
Thanks in advance