This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

In SPI slave, MISO doesn't work

HW environment :

  • SPI Slave : PCA10028 board, and reference source code is 'peripheral/spi_slave' in SDK9.0.0
  • SPI Master : Arduino UNO

Pin setting is below

SPIS_MISO_PIN 28 // SPI MISO signal.

SPIS_CSN_PIN 12 // SPI CSN signal.

SPIS_MOSI_PIN 25 // SPI MOSI signal.

SPIS_SCK_PIN 29 // SPI SCK signal.

I believe there was no pin wiring mistake between two board.

And I could find a code of 'p_tx_buf[i] = (uint8_t)('a' + i);' in the function of 'spi_slave_buffers_init', inside the project 'spi_slave'.

So pca10028 board is believed to send some character pattern like "abcdef...". through MISO line.

But there is no signal from MISO at all.

image description

MOSI signal is "hello' with setting of LSB, 1MHz. And it seems no problem. I've tested UNO part source code with another UNO board as a spi slave, and it had no problem.

But now it's not working. I don't understand this situation. Do I have to set the clock of spi slave? if so, how?

Parents
  • Hi

    You do not have to set the clock of nRF51's SPI slave. It should output data on MISO when you clock out data on the master, even though you have no data to send on the slave side, it should clock out the ORC character, which is by default in the SDK 9.0.0 example with the value 0x55.

    I assume from your image that SEL line is the chip selects that Arduino sets to start the SPI transaction. What I recognize is that SEL is not constantly low during the transaction. In three places it is toggling to high, like it is floating. the logical analyzer you have can clearly only show high or low and nothing in between. If the actual signal is floating between high and low, the nRF51 might not detect it as low, and in that case, it will not put anything out on MISO. The nRF51 pullup resistor is typically 13kohm. Could there be something creating disturbance on the SEL line, or the Arduino not pulling the SEL line sufficiently?

    Are you receiving any data on the nRF51 side?

    What mode is the SPIS in, i.e. what settings do you have for CPOL adn CPHA? It should match with the SPI configuration on the Arduino.

    Are you using a standard Arduino UNO SPI master example that I could try out? Are you using SPI slave example from SDK 9.0.0 unmodified?

    Update 15.10.2015 To start debugging, you don't have to think about UART. You start with opening the SPIS example in Keil and then you follow the steps as in the following image while having your board connected to your PC via USB

    • Step 1: Remove compiler optimization by choosing Level 0 optimization
    • Step 2: Set the breakpoint where you want the program to halt
    • Step 3: Recompile
    • Step 4: Start debugging, which will automatically flash the code to the board before the actual program execution starts

    image description

    Update 19.10.2015 I suspect you are missing the correct device family pack. you should be using 8.0.3 or later.

    1. Press the pack installer button
    2. Select the nRF51422 QFAC
    3. Download packs updates. Wait for packs to download, progress is shown in the lower right corner.
    4. Press install button for the "NordicSemiConductor:nRF_DeviceFamilyPack"
    5. Verify that DeviceFamilyPack is 8.0.3 or later.

    image description

    Use the nRF51 SDK zip (not packs):

    1. Download SDK 9.0.0 zip (no packs) from developer.nordicsemi.com,
    2. unzip,
    3. browse to the spi_slave example and open the project file,
    4. set up the project for debugging as previously described,
    5. start debugging
  • I followed your instruction(level 0 optimization), but debugging can not be activated.

    << Here I paste "compiler control string" of mine. >>

    -c --cpu Cortex-M0 -D__EVAL -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I....\config -I.... -I........\bsp -I..........\components\drivers_nrf\spi_slave -I..........\components\device -I..........\components\toolchain -I..........\components\libraries\button -I..........\components\drivers_nrf\gpiote -I..........\components\drivers_nrf\config -I..........\components\libraries\util -I..........\components\drivers_nrf\common -I..........\components\drivers_nrf\hal -I..........\components\libraries\timer -I..........\components\drivers_nrf\nrf_soc_nosd -IF:\Keil_v5\ARM\Pack\ARM\CMSIS\4.3.0\CMSIS\Include --c99 -I F:\Keil_v5\ARM\RV31\INC -I F:\Keil_v5\ARM\CMSIS\Include -D__UVISION_VERSION="515" -DBOARD_PCA10028 -DNRF51 -DSWI_DISABLE0 -o "._build*.o" --omf_browse "._build*.crf" --depend "._build*.d"

Reply
  • I followed your instruction(level 0 optimization), but debugging can not be activated.

    << Here I paste "compiler control string" of mine. >>

    -c --cpu Cortex-M0 -D__EVAL -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I....\config -I.... -I........\bsp -I..........\components\drivers_nrf\spi_slave -I..........\components\device -I..........\components\toolchain -I..........\components\libraries\button -I..........\components\drivers_nrf\gpiote -I..........\components\drivers_nrf\config -I..........\components\libraries\util -I..........\components\drivers_nrf\common -I..........\components\drivers_nrf\hal -I..........\components\libraries\timer -I..........\components\drivers_nrf\nrf_soc_nosd -IF:\Keil_v5\ARM\Pack\ARM\CMSIS\4.3.0\CMSIS\Include --c99 -I F:\Keil_v5\ARM\RV31\INC -I F:\Keil_v5\ARM\CMSIS\Include -D__UVISION_VERSION="515" -DBOARD_PCA10028 -DNRF51 -DSWI_DISABLE0 -o "._build*.o" --omf_browse "._build*.crf" --depend "._build*.d"

Children
No Data
Related