Lora-net / SWL2001

LoRa Basics Modem LoRaWAN stack
BSD 3-Clause Clear License
87 stars 50 forks source link

ral_init() failure due to retention list register return value #38

Closed bdesterBE closed 4 months ago

bdesterBE commented 4 months ago

Hello,

I recently started a board port of SWL2001 for an ESP32S3 to function with the SX1262. I am currently using a slightly modified 2_porting_nrf_52840/main_examples/main_porting_tests.c file to test the correctness of the port.

When running the tests, it keeps failing at ral_init() in the porting_test_radio_irq() function. Going through the call stack, I found that it is failing after retrieving the retention register values. The value is always 0xA2, which is far larger than the SX126X_MAX_NB_REG_IN_RETENTION value set of 4. To see what happens, I increased the value of SX126X_MAX_NB_REG_IN_RETENTION to 170 (0xAA) and I successfully get past this point in ral_init().

I know that 0xA2 is the typical value seen on the SPI bus MISO line when writing to the SX1262. This leads me to believe that it would likely have to do with how I am reading.

If anybody has any insight, help is greatly appreciated.

Thanks.

bdesterBE commented 4 months ago

It is indeed my SPI read function. I was not sending out the commands correctly.