[riot-notifications] [RIOT-OS/RIOT] tests/driver_sx127x problem (#11838)

isavitsky notifications at github.com
Sat Jul 13 00:04:02 CEST 2019


#### Description
<!--
Example: Cannot build gnrc_networking application for samr21-xpro board.
-->

tests/driver_sx127x hangs during the SPI exchange with RFM96 rev. 1.2 (RF98) 433 MHz module on Nucleo-L432KC board.

#### Steps to reproduce the issue
<!--
Try to describe as precisely as possible here the steps required to reproduce
the issue. Here you can also describe your hardware configuration, the network
setup, etc.
-->
1) Connect the RFM96 module to the Nucleo-L432KC board in the following configuration:
```
  GND -> GND
 3.3V -> 3V3
 MISO -> D12
 MOSI -> D11
  SCK -> D13
  NSS -> D10
RESET -> A0
 DIO0 -> D2
```
2) Specify BOARD and CFLAGS in the Makefile:
```
BOARD ?= nucleo-l432kc
# SPI1_CS (NSS)       /* D10, PA11 */
CFLAGS+= -DSX127X_PARAM_SPI_NSS="GPIO_PIN(0,11)"
```
3) Connect the Nucleo board to the USB and start the terminal.
4) cd into tests/driver_sx127x directory and do
```
make flash
```

#### Expected results
<!--
Example: The gnrc_networking application builds on samr21-xpro.
-->

The tests/driver_sx127x should build flawlessly and the command shell should start.

#### Actual results
<!--
Please paste or specifically describe the actual output.
-->

Actual results are that the test programme is starting the RFM96 module initialisation and then hanging in the middle of an SPI exchange. Here is the full terminal output with DEBUG enabled (additional debug printouts added to track down the failure step):

```
main(): This is RIOT! (Version: 2019.10-devel-25-g6b094)
[sx127x] netdev: initializing driver...
[sx127x] SPI_0 initialized with success
	spi_acquire()
	spi_transfer_bytes()
		now call transfer_no_dma():
		transfer_no_dma() TX (len: 1): 42 
			wait_for_end()
	spi_transfer_bytes()
		now call transfer_no_dma():
		transfer_no_dma() RX (len: 1): 12 
			wait_for_end()
	spi_release()
[sx127x] SX1276 transceiver detected
	spi_acquire()
	spi_transfer_bytes()
		now call transfer_no_dma():
		transfer_no_dma() TX (len: 1): 09 
			wait_for_end()
	spi_transfer_bytes()
		now call transfer_no_dma():
		transfer_no_dma() RX (len: 1): 4F 
			wait_for_end()
	spi_release()
	spi_acquire()
	spi_transfer_bytes()
		now call transfer_no_dma():
		transfer_no_dma() TX (len: 1): 06 
			wait_for_end()
	spi_transfer_bytes()
		now call transfer_no_dma():
		transfer_no_dma() RX (len: 1): 6C 
			wait_for_end()
	spi_release()
	spi_acquire()
	spi_transfer_bytes()
		now call transfer_no_dma():
		transfer_no_dma() TX (len: 1): 07 
			wait_for_end()
	spi_transfer_bytes()
		now call transfer_no_dma():
		transfer_no_dma() RX (len: 1): 80 
			wait_for_end()
	spi_release()
	spi_acquire()
	spi_transfer_bytes()
		now call transfer_no_dma():
		transfer_no_dma() TX (len: 1): 08 
			wait_for_end()
	spi_transfer_bytes()
		now call transfer_no_dma():
		transfer_no_dma() RX (len: 1): 00 
			wait_for_end()
	spi_release()
	spi_acquire()
	spi_transfer_bytes()
		now call transfer_no_dma():
		transfer_no_dma() TX (len: 1): 89 
			wait_for_end()
	spi_transfer_bytes()
		now call transfer_no_dma():
		transfer_no_dma() TX (len: 1): 00 
			wait_for_end()
	spi_release()
	spi_acquire()
	spi_transfer_bytes()
		now call transfer_no_dma():
		transfer_no_dma() TX (len: 1): 3B 
			wait_for_end()
	spi_transfer_bytes()
		now call transfer_no_dma():
		transfer_no_dma() RX (len: 1): 82 
			wait_for_end()
	spi_release()
	spi_acquire()
	spi_transfer_bytes()
		now call transfer_no_dma():
		transfer_no_dma() TX (len: 1): BB 
			wait_for_end()
	spi_transfer_bytes()
		now call transfer_no_dma():
		transfer_no_dma() TX (len: 1): C2 
			wait_for_end()
	spi_release()
	spi_acquire()
	spi_transfer_bytes()
		now call transfer_no_dma():
		transfer_no_dma() TX (len: 1): 3B 
			wait_for_end()
	spi_transfer_bytes()
		now call transfer_no_dma():
		transfer_no_dma() RX (len: 1): 82 
			wait_for_end()
	spi_release()
[sx127x] Set channel: 868000000
	spi_acquire()
	spi_transfer_bytes()
		now call transfer_no_dma():
		transfer_no_dma() TX (len: 1): 86 
			wait_for_end()
	spi_transfer_bytes()
		now call transfer_no_dma():
		transfer_no_dma() TX (len: 1): D9 
			wait_for_end()
	spi_release()
	spi_acquire()
	spi_transfer_bytes()
		now call transfer_no_dma():
		transfer_no_dma() TX (len: 1): 87 
			wait_for_end()
	spi_transfer_bytes()
		now call transfer_no_dma():
		transfer_no_dma() TX (len: 1): 00 
			wait_for_end()
	spi_release()
	spi_acquire()
	spi_transfer_bytes()
		now call transfer_no_dma():
		transfer_no_dma() TX (len: 1): 88 
			wait_for_end()
	spi_transfer_bytes()
		now call transfer_no_dma():
		transfer_no_dma() TX (len: 1): 00 
			wait_for_end()
	spi_release()
	spi_acquire()
	spi_transfer_bytes()
		now call transfer_no_dma():
		transfer_no_dma() TX (len: 1): 3B 
			wait_for_end()
	spi_transfer_bytes()
		now call transfer_no_dma():
		transfer_no_dma() RX (len: 1): 82 
			wait_for_end()
	spi_release()
	spi_acquire()
	spi_transfer_bytes()
		now call transfer_no_dma():
		transfer_no_dma() TX (len: 1): BB 
			wait_for_end()
	spi_transfer_bytes()
		now call transfer_no_dma():
		transfer_no_dma() TX (len: 1): C2 
			wait_for_end()
	spi_release()
	spi_acquire()
	spi_transfer_bytes()
		now call transfer_no_dma():
		transfer_no_dma() TX (len: 1): 3B 
			wait_for_end()
	spi_transfer_bytes()
		now call transfer_no_dma():
		transfer_no_dma() RX (len: 1): 82 
			wait_for_end()
	spi_release()
	spi_acquire()
	spi_transfer_bytes()
		now call transfer_no_dma():
		transfer_no_dma() TX (len: 1): 89 
			wait_for_end()
	spi_transfer_bytes()
		now call transfer_no_dma():
		transfer_no_dma() TX (len: 1): 4F 
			wait_for_end()
	spi_release()
[sx127x] Set channel: 434000000
	spi_acquire()
	spi_transfer_bytes()
		now call transfer_no_dma():
		transfer_no_dma() TX (len: 1): 86 
			wait_for_end()
	spi_transfer_bytes()
		now call transfer_no_dma():
		transfer_no_dma() TX (len: 1): 6C 
			wait_for_end()
	spi_release()
	spi_acquire()
	spi_transfer_bytes()
		now call transfer_no_dma():
		transfer_no_dma() TX (len: 1): 87 
			wait_for_end()
	spi_transfer_bytes()
		now call transfer_no_dma():
		transfer_no_dma() TX (len: 1): 80 
			wait_for_end()
	spi_release()
	spi_acquire()
	spi_transfer_bytes()
		now call transfer_no_dma():
		transfer_no_dma() TX (len: 1): 88 
			wait_for_end()
	spi_transfer_bytes()
		now call transfer_no_dma():
		transfer_no_dma() TX (len: 1): 00 
			wait_for_end()
	spi_release()
[sx127x] Set op mode: SLEEP
	spi_acquire()
	spi_transfer_bytes()
		now call transfer_no_dma():
		transfer_no_dma() TX (len: 1): 01 
			wait_for_end()
	spi_transfer_bytes()
		now call transfer_no_dma():
		transfer_no_dma() RX (len: 1): 09 
			wait_for_end()
	spi_release()
	spi_acquire()
	spi_transfer_bytes()
		now call transfer_no_dma():
		transfer_no_dma() TX (len: 1): 81 
			wait_for_end()
	spi_transfer_bytes()
		now call transfer_no_dma():
		transfer_no_dma() TX (len: 1): 08 
			wait_for_end()
	spi_release()
[sx127x] initializing radio settings
[sx127x] Set channel: 868300000
	spi_acquire()
	spi_transfer_bytes()
		now call transfer_no_dma():
		transfer_no_dma() TX (len: 1): 86 
			wait_for_end()
	spi_transfer_bytes()
		now call transfer_no_dma():
		transfer_no_dma() TX (len: 1): D9 
			wait_for_end()
	spi_release()
	spi_acquire()
	spi_transfer_bytes()
		now call transfer_no_dma():
		transfer_no_dma() TX (len: 1): 87 
			wait_for_end()
	spi_transfer_bytes()
		now call transfer_no_dma():
		transfer_no_dma() TX (len: 1): 13 
			wait_for_end()
	spi_release()
	spi_acquire()
	spi_transfer_bytes()
		now call transfer_no_dma():
		transfer_no_dma() TX (len: 1): 88 
			wait_for_end()
	spi_transfer_bytes()
		now call transfer_no_dma():
		transfer_no_dma() TX (len: 1): 33 
			wait_for_end()
	spi_release()
[sx127x] set modem: 1
	spi_acquire()
	spi_transfer_bytes()
		now call transfer_no_dma():
		transfer_no_dma() TX (len: 1): 01 
			wait_for_end()
	spi_transfer_bytes()
		now call transfer_no_dma():
```

As far as we can see, the sx127x driver is been able to find out the chip version (0x12) and then in the last few lines we observe that the sx127x driver is going to set modem 1. At first the SPI read register 0x01 command was sent, then spi_transfer_bytes() have to read the result by calling the _transfer_no_dma() function which never happens. 

Please, help me find out what I'm missing here to make this test working.
Thanks, Ivan

#### Versions
<!--
Operating system: Mac OSX, Linux, Vagrant VM
Build environment: GCC, CLang versions (you can run the following command from
the RIOT base directory: make print-versions).
-->
```

Operating System Environment
-----------------------------
       Operating System: "Linux Mint" "18.3 (Sylvia)"
                 Kernel: Linux 4.13.0-45-generic x86_64 x86_64

Installed compiler toolchains
-----------------------------
             native gcc: gcc (Ubuntu 5.4.0-6ubuntu1~16.04.11) 5.4.0 20160609
      arm-none-eabi-gcc: arm-none-eabi-gcc (GNU Tools for Arm Embedded Processors 7-2018-q3-update) 7.3.1 20180622 (release) [ARM/embedded-7-branch revision 261907]
                avr-gcc: missing
       mips-mti-elf-gcc: missing
             msp430-gcc: missing
   riscv-none-embed-gcc: missing
   xtensa-esp32-elf-gcc: missing
   xtensa-lx106-elf-gcc: xtensa-lx106-elf-gcc (crosstool-NG crosstool-ng-1.22.0-60-g37b07f6) 4.8.5
                  clang: missing

Installed compiler libs
-----------------------
   arm-none-eabi-newlib: "3.0.0"
    mips-mti-elf-newlib: missing
riscv-none-embed-newlib: missing
xtensa-esp32-elf-newlib: missing
xtensa-lx106-elf-newlib: "2.0.0"
               avr-libc: missing (missing)

Installed development tools
---------------------------
                  cmake: cmake version 3.5.1
               cppcheck: missing
                doxygen: 1.8.11
                 flake8: missing
                    git: git version 2.7.4
                   make: GNU Make 4.1
                openocd: Open On-Chip Debugger 0.10.0
                 python: Python 2.7.12
                python2: Python 2.7.12
                python3: Python 3.5.2
             coccinelle: missing
```
<!-- Thanks for contributing! -->


-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/issues/11838
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190712/833eba53/attachment-0001.html>


More information about the notifications mailing list