cancel
Showing results for 
Search instead for 
Did you mean: 

Questions re: S2-LP radio configuration and usage, possible bug in s2LP-DEVKIT, and using STEVAL-FKI915V1 as my test boards.

BKobl.1
Associate

I have written (what I consider) a pretty nice multi-threaded application that configures multiple radios in a network including the ability to forward through intermediate radios. I have most of my system working pretty smoothly.

I am more a sw person than radio freak so I may not be reading the documentation correctly.

However, I spent the last two weeks tracking down a bug that I believe is caused by race conditions accessing the SPI channel controlling the radio. The manifestation is the irqstatus for the radio (MASK3...MASK0) gets changed but I am not changing it. The S2LP_CORE_SPI.c file seems to have a global tx and rx buffer with multiple routines that write the tx and read the rx OUTSIDE of the region protected by SPI_ENTER_CRITICAL and SPI_EXIT_CRITICAL. It seems to me that there is a race where the operation (say read a register) in the tx_buff can be overwritten by another (from the irq handler?) spi operation that writes a different command to the tx_buff resulting in chaos. Can anyone confirm my suspicions? This has been incredibly difficult to track down. Each of the routines start like below and you can see unprotected access to writing tx_buff:

uint16_t S2LPSpiReadRegisters(uint8_t address, uint8_t n_bytes, uint8_t* buffer)

{

 tx_buff[0]=READ_HEADER;

 tx_buff[1]=address;

...

SPI_ENTER_CRITICAL();

 SdkEvalSPICSLow();

...

and

uint16_t S2LPSpiWriteRegisters(uint8_t address, uint8_t n_bytes, uint8_t* buffer)

{

 tx_buff[0]=WRITE_HEADER;

 tx_buff[1]=address;

...

SPI_ENTER_CRITICAL();

...

I also had a problem where I was not able to get any carrier sense and I believe my error was that I need to be in receiving mode in order to see carrier sense. Can someone confirm that? (I do get carrier sense now).

I also am not really sure how to interpret the state diagram and transitions from READY/LOCK/RX/TX. I currently seem to move (fine?) between StrobeRX and StrobeTX without issuing an abort. Is that ok? Or is the abort required? Then the documentation seems to indicate I need to go through a LOCK state before going to RX or TX but I am not doing that and not sure what is required. The core question is if I want to generally be in RX mode with breaking out for TX, what is the correct approach. (Some operations in the IRQHandler, and others in my main application.)

Only two more issues:

I tried to use csma (instead of doing it all myself checking carrier state), but when I enable csma, I cannot receive messages, but the csma transmissions work as expected (sometimes succeeding and sometimes timing out. Is there any way that csma should affect reception of messages? (This was before I found the SPI race condition which could have be affecting this.)

And finally, I believe with the radios I am using I should have no problem with 1mile access given good line of site in a rural area. But I am not getting close to that. Can someone suggest settings (STEVAL-FKI915V1) that should allow me to send messages medium distances? I am generally using the devkit defaults, but I can adjust the POWER8 level as needed. I am wondering what else I need to adjust with that.

thanks

-brian

0 REPLIES 0