nopnop2002 / esp-idf-sx126x

SX1262/SX1268/LLCC68 Low Power Long Range Transceiver driver for esp-idf
MIT License
79 stars 18 forks source link

Why is LLCC68 SetStandby(SX126X_STANDBY_RC) ; SPI Transaction error: 10 #19

Closed niubbbbbbbb closed 1 year ago

niubbbbbbbb commented 1 year ago

Why is LLCC68 SetStandby (SX126X_STANDBY_RC) used; SPI Transaction error: 10

nopnop2002 commented 1 year ago

I can't understand what the problem is.

niubbbbbbbb commented 1 year ago

When I use LLCC68, I used SetStandby (SX126X_STANDBY_RC) in LoRaBegin,but in SetStandby SPI Transaction error: 10

niubbbbbbbb commented 1 year ago

image image LLCC68

nopnop2002 commented 1 year ago

Are there devices other than LLCC68 on the same SPI bus?

niubbbbbbbb commented 1 year ago

No one on the same bus

nopnop2002 commented 1 year ago

I want to see all logging

niubbbbbbbb commented 1 year ago

I didn't save the log, but I remember these values image

nopnop2002 commented 1 year ago

Unfortunately, I can't analyze it without seeing all the logging from the firmware start.

niubbbbbbbb commented 1 year ago

Waiting for the device to reconnect.... I (271) esp_image: segment 4: paddr=000c9adc vaddr=4037bcI (1388) nvm_dev: nvm dev create type = 1 result:0 I (1389) nvm_dev: TNvmDevDoOpen result = 0 opstate = 2 I (1389) nvm_dev: TNvmDevOpen type:1 result:0 AstPmmInit I (1390) pmm_bitmap: TPmmBitMapCreate - i=132096 8 0 0 I (1390) pmm_bitmap: TPmmBitMapLoad - 1 = 0x00000000 I (1390) nvm_like_eeprom: TNvmSdEepromRead 1 offset = 32768-32768 I (1391) pmm_bitmap: TPmmBitMapLoad - 2 0x00000000 8 I (1391) nvm_like_eeprom: TNvmSdEepromRead 1 offset = 32776-32768 I (1392) pmm_bitmap: TPmmBitMapCreate - i=133120 4 2048 0 I (1392) pmm_bitmap: TPmmBitMapLoad - 1 = 0x00000800 I (1393) nvm_like_eeprom: TNvmSdEepromRead 1 offset = 34816-32768 I (1394) pmm_bitmap: TPmmBitMapLoad - 2 0x00000800 8 I (1394) nvm_like_eeprom: TNvmSdEepromRead 1 offset = 34824-32768 I (1395) pmm_bitmap: TPmmBitMapCreate - i=134144 6 5120 0 I (1395) pmm_bitmap: TPmmBitMapLoad - 1 = 0x00001400 I (1395) nvm_like_eeprom: TNvmSdEepromRead 1 offset = 37888-36864 I (1396) pmm_bitmap: TPmmBitMapLoad - 2 0x00001400 8 I (1396) nvm_like_eeprom: TNvmSdEepromRead 1 offset = 37896-36864 I (1397) pmm_bitmap: TPmmBitMapCreate - i=135168 0 10240 0 I (1397) pmm_bitmap: TPmmBitMapLoad - 1 = 0x00002800 I (1398) nvm_like_eeprom: TNvmSdEepromRead 1 offset = 43008-40960 I (1399) pmm_bitmap: TPmmBitMapLoad - 2 0x00002800 8 I (1399) nvm_like_eeprom: TNvmSdEepromRead 1 offset = 43016-40960 I (1400) pmm_bitmap: TPmmBitMapCreate - i=136192 4 19456 0 I (1400) pmm_bitmap: TPmmBitMapLoad - 1 = 0x00004c00 I (1400) nvm_like_eeprom: TNvmSdEepromRead 1 offset = 52224-49152 I (1401) pmm_bitmap: TPmmBitMapLoad - 2 0x00004c00 8 I (1401) nvm_like_eeprom: TNvmSdEepromRead 1 offset = 52232-49152 I (1403) nvm_like_eeprom: TNvmSdEepromRead 1 offset = 53248-53248 I (1404) nvm_like_eeprom: TNvmSdEepromRead 1 offset = 53256-53248 I (1405) pmm_map: AstPmmGetPidActivePart - 1 133120-1-1 I (1405) pmm_bitmap: get_bit_value - 1 pid = 133120 133120 4 1 I (1406) pmm_bitmap: get_bit_value - 2 index = 0 0 0 I (1406) main: Frequency is 915MHz I (1407) pmm_map: AstPmmGetPidActivePart - 1 132096-0-0 I (1407) pmm_bitmap: get_bit_value - 1 pid = 132096 132096 8 1 I (1407) pmm_bitmap: get_bit_value - 2 index = 0 0 0 I (1408) pmm_map: AstPmmGetPidActivePart - 1 133120-1-1 I (1408) pmm_bitmap: get_bit_value - 1 pid = 133120 133120 4 1 I (1408) pmm_bitmap: get_bit_value - 2 index = 0 0 0 I (1408) main: Frequency is 416062500MHz, LoraFre = 4, ChunFengVIN = 0x1234 I (1409) RA01S: CONFIG_MISO_GPIO=13 I (1409) RA01S: CONFIG_MOSI_GPIO=11 I (1409) RA01S: CONFIG_SCLK_GPIO=12 I (1409) RA01S: CONFIG_NSS_GPIO=10 I (1409) RA01S: CONFIG_RST_GPIO=8 I (1409) RA01S: CONFIG_BUSY_GPIO=9 I (1410) RA01S: CONFIG_TXEN_GPIO=15 I (1410) RA01S: CONFIG_RXEN_GPIO=7 I (1410) gpio: GPIO[10]| InputEn: 0| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0 I (1411) gpio: GPIO[8]| InputEn: 0| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0 I (1411) gpio: GPIO[9]| InputEn: 0| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0 I (1411) gpio: GPIO[15]| InputEn: 0| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0 I (1412) gpio: GPIO[7]| InputEn: 0| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0 I (1413) RA01S: spi_bus_initialize=0 I (1413) RA01S: spi_bus_add_device=0 I (1414) RA01S: LoRaBegin in1 I (1454) RA01S: Reset I (1454) RA01S: syncWord=0x1424 I (1455) RA01S: SX126x installed1 W (1455) LORATEST: SetStandby1 MODE = 1 I (1455) RA01S: WriteCommand: CMD=0x80 E (1455) RA01S: in3 & 0b00001110a E (1456) RA01S: SPI Transaction error:a

This is a retyped log, which contains additional component logs

niubbbbbbbb commented 1 year ago

image

nopnop2002 commented 1 year ago

Are you using this?

https://github.com/nopnop2002/esp-idf-sx126x/tree/main/basic

niubbbbbbbb commented 1 year ago

yes

niubbbbbbbb commented 1 year ago

I used lierda's library is success

nopnop2002 commented 1 year ago

I (1408) main: Frequency is 416062500MHz, LoraFre = 4, ChunFengVIN = 0x1234

What is this logging? not in my code.

Below is my logging. It's completely different from your logging, so I can't analyze it.

I (0) cpu_start: App cpu up.
I (229) cpu_start: Pro cpu start user code
I (229) cpu_start: cpu freq: 160000000 Hz
I (229) cpu_start: Application information:
I (234) cpu_start: Project name:     lora
I (239) cpu_start: App version:      1
I (243) cpu_start: Compile time:     Feb  5 2023 14:23:07
I (249) cpu_start: ELF file SHA256:  7d3341d496607243...
I (255) cpu_start: ESP-IDF:          v5.0-494-g490216a2ac-dirty
I (262) heap_init: Initializing. RAM available for dynamic allocation:
I (269) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
I (275) heap_init: At 3FFB2948 len 0002D6B8 (181 KiB): DRAM
I (281) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (288) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (294) heap_init: At 4008CE5C len 000131A4 (76 KiB): IRAM
I (302) spi_flash: detected chip: winbond
I (305) spi_flash: flash io: dio
W (309) spi_flash: Detected size(4096k) larger than the size in the binary image header(2048k). Using the size in the binary image header.
I (323) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
I (333) main: Frequency is 433MHz
I (333) RA01S: CONFIG_MISO_GPIO=19
I (343) RA01S: CONFIG_MOSI_GPIO=23
I (343) RA01S: CONFIG_SCLK_GPIO=18
I (353) RA01S: CONFIG_NSS_GPIO=15
I (353) RA01S: CONFIG_RST_GPIO=16
I (353) RA01S: CONFIG_BUSY_GPIO=17
I (363) RA01S: CONFIG_TXEN_GPIO=-1
I (363) RA01S: CONFIG_RXEN_GPIO=-1
I (373) gpio: GPIO[15]| InputEn: 0| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
I (383) gpio: GPIO[16]| InputEn: 0| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
I (393) gpio: GPIO[17]| InputEn: 0| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
I (393) RA01S: spi_bus_initialize=0
I (403) RA01S: spi_bus_add_device=0
I (443) RA01S: Reset
I (443) RA01S: syncWord=0x1424
I (443) RA01S: SX126x installed
I (443) RA01S: tcxoVoltage=0.000000
I (453) RA01S: useRegulatorLDO=0
I (453) MAIN: LoRaBegin=0
I (453) RA01S: SetStopRxTimerOnPreambleDetect enable=0
I (463) task_rx: Start

I don't know lierda's library.

Option with SX1262/1268

LoRa modules with SX1262/1268 have several options.

You need to look at the schematic to set these options properly, but it's very esoteric.
The default settings for this library are for Ra-01S / Ra-01SH.
When using other than Ra-01S / Ra-01SH, you need to set them appropriately.
I don't have a SX126X other than Ra-01S / Ra-01SH. Therefore, I don't know the settings of SX126X other than Ra-01S / Ra-01SH.

Ra-01SC uses LLCC68.
Ra-01SC is compatible with Ra-01S.
However, there are the following restrictions:

When using LLCC68 other than Ra-01SC, it is necessary to set the options appropriately based on the datasheet. I don't have a LLCC68 other than Ra-01SC. Therefore, I don't know the settings of LLCC68 other than Ra-01SC.


I (1455) RA01S: WriteCommand: CMD=0x80
E (1455) RA01S: in3 & 0b00001110a
E (1456) RA01S: SPI Transaction error:a

This error is typical of incorrect settings. This library does not use TCXO by default. Your module may use TCXO.

niubbbbbbbb commented 1 year ago

It's not about setting up TCXO. This error occurs in setstandby before setting TCXO

nopnop2002 commented 1 year ago

There are no errors in my log.

This error only occurs in your environment.

For some reason your module can't go into StandBy mode.

Enable LoRaDebugPrint to see the response from the module.

As written in the datasheet, writing via SPI returns the status of the module.

I (0) cpu_start: Starting scheduler on APP CPU.
I (332) main: Frequency is 433MHz
I (332) RA01S: CONFIG_MISO_GPIO=19
I (342) RA01S: CONFIG_MOSI_GPIO=23
I (342) RA01S: CONFIG_SCLK_GPIO=18
I (352) RA01S: CONFIG_NSS_GPIO=15
I (352) RA01S: CONFIG_RST_GPIO=16
I (352) RA01S: CONFIG_BUSY_GPIO=17
I (362) RA01S: CONFIG_TXEN_GPIO=-1
I (362) RA01S: CONFIG_RXEN_GPIO=-1
I (372) gpio: GPIO[15]| InputEn: 0| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
I (382) gpio: GPIO[16]| InputEn: 0| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
I (392) gpio: GPIO[17]| InputEn: 0| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
I (392) RA01S: spi_bus_initialize=0
I (402) RA01S: spi_bus_add_device=0
I (442) RA01S: Reset
I (442) RA01S: ReadRegister: REG=0x740
I (442) RA01S: DataIn:14
I (442) RA01S: DataIn:24
I (452) RA01S: syncWord=0x1424
I (452) RA01S: SX126x installed
I (452) RA01S: WriteCommand: CMD=0x80
I (462) RA01S: 00 --> a2
I (462) RA01S: WriteCommand: CMD=0x9d
I (472) RA01S: 01 --> a2
I (472) RA01S: tcxoVoltage=0.000000
I (472) RA01S: WriteCommand: CMD=0x89
I (482) RA01S: 7f --> a2
I (482) RA01S: useRegulatorLDO=0
I (482) RA01S: WriteCommand: CMD=0x96
I (492) RA01S: 01 --> a2
I (492) RA01S: WriteCommand: CMD=0x8f
I (502) RA01S: 00 --> a2
I (502) RA01S: 00 --> a2
I (502) RA01S: WriteCommand: CMD=0x95
I (512) RA01S: 04 --> a2
I (512) RA01S: 07 --> a2
I (512) RA01S: 00 --> a2
I (522) RA01S: 01 --> a2
I (522) RA01S: WriteRegister: REG=0x8e7
I (522) RA01S: 18 --> a2
I (532) RA01S: WriteCommand: CMD=0x8e
I (532) RA01S: 16 --> a2
I (532) RA01S: 04 --> a2
I (542) RA01S: WriteCommand: CMD=0x98
I (542) RA01S: 6b --> a2
I (552) RA01S: 6f --> a2
I (552) RA01S: WriteCommand: CMD=0x86
I (552) RA01S: 1b --> a2
I (562) RA01S: 10 --> a2
I (562) RA01S: 00 --> a2
I (562) RA01S: 00 --> a2
I (572) MAIN: LoRaBegin=0
I (572) RA01S: WriteCommand: CMD=0x9f
I (572) RA01S: 00 --> a2
I (582) RA01S: WriteCommand: CMD=0xa0
I (582) RA01S: 00 --> a2
I (582) RA01S: WriteCommand: CMD=0x8a
I (592) RA01S: 01 --> a2
I (592) RA01S: WriteCommand: CMD=0x8b
I (602) RA01S: 07 --> a2
I (602) RA01S: 04 --> a2
I (602) RA01S: 01 --> a2
I (612) RA01S: 00 --> a2
I (612) RA01S: ReadRegister: REG=0x736
I (612) RA01S: DataIn:0d
I (622) RA01S: WriteRegister: REG=0x736
I (622) RA01S: 09 --> a2
I (622) RA01S: WriteCommand: CMD=0x8c
I (632) RA01S: 00 --> a2
I (632) RA01S: 08 --> a2
I (642) RA01S: 00 --> a2
I (642) RA01S: ff --> a2
I (642) RA01S: 01 --> a2
I (652) RA01S: 00 --> a2
I (652) RA01S: WriteCommand: CMD=0x08
I (652) RA01S: 03 --> a2
I (662) RA01S: ff --> a2
I (662) RA01S: 00 --> a2
I (662) RA01S: 00 --> a2
I (672) RA01S: 00 --> a2
I (672) RA01S: 00 --> a2
I (672) RA01S: 00 --> a2
I (682) RA01S: 00 --> a2
I (682) RA01S: ----- SetRx timeout=16777215
I (682) RA01S: WriteCommand: CMD=0x80
I (692) RA01S: 00 --> a2
I (692) RA01S: SetRxEnable:SX126x_TXEN=-1 SX126x_RXEN=-1
I (702) RA01S: WriteCommand: CMD=0x82
I (702) RA01S: ff --> a2
I (702) RA01S: ff --> a2
I (712) RA01S: ff --> a2
I (712) RA01S: ReadCommand: CMD=0xc0
I (712) RA01S: DataIn:52
I (722) RA01S: ReadCommand: CMD=0xc0
I (722) RA01S: DataIn:52
I (732) task_tx: Start
nopnop2002 commented 1 year ago

Your logging is completely different from mine. This is your logging.

Waiting for the device to reconnect....
I (271) esp_image: segment 4: paddr=000c9adc vaddr=4037bcI (1388) nvm_dev: nvm dev create type = 1 result:0
I (1389) nvm_dev: TNvmDevDoOpen result = 0 op_state_ = 2
I (1389) nvm_dev: TNvmDevOpen type:1 result:0
AstPmmInit
I (1390) pmm_bitmap: TPmmBitMapCreate - i=132096 8 0 0
I (1390) pmm_bitmap: TPmmBitMapLoad - 1 = 0x00000000
I (1390) nvm_like_eeprom: TNvmSdEepromRead 1 offset = 32768-32768
I (1391) pmm_bitmap: TPmmBitMapLoad - 2 0x00000000 8
I (1391) nvm_like_eeprom: TNvmSdEepromRead 1 offset = 32776-32768
I (1392) pmm_bitmap: TPmmBitMapCreate - i=133120 4 2048 0
I (1392) pmm_bitmap: TPmmBitMapLoad - 1 = 0x00000800
I (1393) nvm_like_eeprom: TNvmSdEepromRead 1 offset = 34816-32768
I (1394) pmm_bitmap: TPmmBitMapLoad - 2 0x00000800 8
I (1394) nvm_like_eeprom: TNvmSdEepromRead 1 offset = 34824-32768
I (1395) pmm_bitmap: TPmmBitMapCreate - i=134144 6 5120 0
I (1395) pmm_bitmap: TPmmBitMapLoad - 1 = 0x00001400
I (1395) nvm_like_eeprom: TNvmSdEepromRead 1 offset = 37888-36864
I (1396) pmm_bitmap: TPmmBitMapLoad - 2 0x00001400 8
I (1396) nvm_like_eeprom: TNvmSdEepromRead 1 offset = 37896-36864
I (1397) pmm_bitmap: TPmmBitMapCreate - i=135168 0 10240 0
I (1397) pmm_bitmap: TPmmBitMapLoad - 1 = 0x00002800
I (1398) nvm_like_eeprom: TNvmSdEepromRead 1 offset = 43008-40960
I (1399) pmm_bitmap: TPmmBitMapLoad - 2 0x00002800 8
I (1399) nvm_like_eeprom: TNvmSdEepromRead 1 offset = 43016-40960
I (1400) pmm_bitmap: TPmmBitMapCreate - i=136192 4 19456 0
I (1400) pmm_bitmap: TPmmBitMapLoad - 1 = 0x00004c00
I (1400) nvm_like_eeprom: TNvmSdEepromRead 1 offset = 52224-49152
I (1401) pmm_bitmap: TPmmBitMapLoad - 2 0x00004c00 8
I (1401) nvm_like_eeprom: TNvmSdEepromRead 1 offset = 52232-49152
I (1403) nvm_like_eeprom: TNvmSdEepromRead 1 offset = 53248-53248
I (1404) nvm_like_eeprom: TNvmSdEepromRead 1 offset = 53256-53248
I (1405) pmm_map: AstPmmGetPidActivePart - 1 133120-1-1
I (1405) pmm_bitmap: get_bit_value - 1 pid = 133120 133120 4 1
I (1406) pmm_bitmap: get_bit_value - 2 index = 0 0 0
I (1406) main: Frequency is 915MHz
I (1407) pmm_map: AstPmmGetPidActivePart - 1 132096-0-0
I (1407) pmm_bitmap: get_bit_value - 1 pid = 132096 132096 8 1
I (1407) pmm_bitmap: get_bit_value - 2 index = 0 0 0
I (1408) pmm_map: AstPmmGetPidActivePart - 1 133120-1-1
I (1408) pmm_bitmap: get_bit_value - 1 pid = 133120 133120 4 1
I (1408) pmm_bitmap: get_bit_value - 2 index = 0 0 0
I (1408) main: Frequency is 416062500MHz, LoraFre = 4, ChunFengVIN = 0x1234
I (1409) RA01S: CONFIG_MISO_GPIO=13
I (1409) RA01S: CONFIG_MOSI_GPIO=11
I (1409) RA01S: CONFIG_SCLK_GPIO=12
I (1409) RA01S: CONFIG_NSS_GPIO=10
I (1409) RA01S: CONFIG_RST_GPIO=8
I (1409) RA01S: CONFIG_BUSY_GPIO=9
I (1410) RA01S: CONFIG_TXEN_GPIO=15
I (1410) RA01S: CONFIG_RXEN_GPIO=7
I (1410) gpio: GPIO[10]| InputEn: 0| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
I (1411) gpio: GPIO[8]| InputEn: 0| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
I (1411) gpio: GPIO[9]| InputEn: 0| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
I (1411) gpio: GPIO[15]| InputEn: 0| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
I (1412) gpio: GPIO[7]| InputEn: 0| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
I (1413) RA01S: spi_bus_initialize=0
I (1413) RA01S: spi_bus_add_device=0
I (1414) RA01S: LoRaBegin in1
I (1454) RA01S: Reset
I (1454) RA01S: syncWord=0x1424
I (1455) RA01S: SX126x installed1
W (1455) LORATEST: SetStandby1 MODE = 1
I (1455) RA01S: WriteCommand: CMD=0x80
E (1455) RA01S: in3 & 0b00001110a
E (1456) RA01S: SPI Transaction error:a

I will ask again.

are you really doing this using esp-idf?

https://github.com/nopnop2002/esp-idf-sx126x/tree/main/basic

Doesn't it include additional component?

This screen clearly looks like it's VSCode Extension.

218058863-0dc503b8-9f0a-4266-91d0-75dd7717d5d7

niubbbbbbbb commented 1 year ago

Yes, I did use components under that path. I added the red log manually. I developed it using vscode and ESP-IDF

nopnop2002 commented 1 year ago

Can you run idf.py from the command line?

idf.py --version
niubbbbbbbb commented 1 year ago

4.4.3

nopnop2002 commented 1 year ago

OK

try this command

git clone https://github.com/nopnop2002/esp-idf-sx126x
cd esp-idf-sx126x/basic/
idf.py set-target {esp32/esp32s2/esp32s3/esp32c2/esp32c3}
idf.py menuconfig
idf.py flash monitor
niubbbbbbbb commented 1 year ago

Sorry, if menuconfig is modified, my project will not run normally

nopnop2002 commented 1 year ago

if menuconfig is modified, my project will not run normally

Why?

The official build instructions are above.

i don't know why.

If it doesn't work without a configuration change, you're doing something wrong.

If you want to change the GPIO you use, you can change it in menuconfig.

niubbbbbbbb commented 1 year ago

Lora is only a part of my project, and there are other components that need to change menuconfig to run. I did not upload this project to gitlab, so I am worried that the project cannot run normally after modification.

nopnop2002 commented 1 year ago

Lora is only a part of my project, and there are other components that need to change menuconfig to run.

Even if your project doesn't work That's your problem, not my library's.

Only you can solve the problem of your project.

My library works fine in my project. Please do not report problems here about your project. Please only report issues related to this library here.

I understand this issue is pointless so I'm closing it.

niubbbbbbbb commented 1 year ago

No, your library should also have problems, because your library can run SX1262 but not LLCC68. Therefore, it is unlikely that any of my other components caused it. After the project is completed, I will find time to investigate this problem

nopnop2002 commented 1 year ago

This library works fine on my LLCC68(AI thinker Ra-01SC).

it is unlikely that any of my other components caused it.

Exclude your other components and see how my library works.

The easiest way is to run this: This also works with LLCC68.

https://github.com/nopnop2002/esp-idf-sx126x/tree/main/basic