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

NRF52832 Sharing SPI Lines with FTDI SPI-USB Bridge

Hi all,

I am making a device which involves using nfr52832(PCA10040) to communicate with a NAND flash through spi to store data acquired from the ADC. After all the data has been stored, the device is then plugged into an FTDI spi-usb (C232hm) to download the data to the pc.

Therefore both the bridge and nordic chip will act as the master and talk to the NAND flash but only one will be talking to it at once. To facilitate this, I have configured them to share the same spi lines.

But I have noticed through testing in a breadboard, that when the the device is connected to the FTDI bridge, if the SCLK line(sharing other lines seems to be fine) is also connected to any pin on the dev board then I get garbage data from the NAND flash. Therefore I was wondering what are the effects of sharing spi lines even when only one master is communicating at any given time. Should I make sure that chip is off when connected to pc by putting a diode on the Vdd line, would this work? However effect is still there even when there is no power going to the dev board and only sharing SCLK line causes this issue. Do I need to use a quad 2-1 mux instead?

Thanks for the help

Regards, Bryan

  • Hi,

    You should not have any voltage on the I/O pins when the chip is not powered. When sharing the SPI lines with another master, it’s recommend to put the SPI pins in the default configuration when the other master is being used. See this post for more information about that.

  • To Sigurd,

    Hi thanks for the quick response. Even when the pca10040 is not powered I am still getting errors when inquiring the NAND flash id ( should be 2C36 but I am getting 10A1), if I dont share SCK then I get the correct id. If I am correct when spi is not used the chip defaults back to all pins in tri state? As when it is powered but running an example that doesnt use the spi peripheral, sharing spi seems to be working.

    So should I use a mux in between or should I use an output from the C232 cable to tell the mcu to put all spi lines to tri?

  • Q: If I am correct when spi is not used the chip defaults back to all pins in tri state?

    A: No, If you have initalized the SPI, the SCK pin will be a output pin and the pin is therefore not in the default configuration(=high impedance mode). Even if you call nrf_drv_spi_uninit(), I belive you have to manually set the SPI pins to the default configuration with nrf_gpio_cfg_default(pin) afterwards.


    Maybe the solution with the output from the C232 cable is the easiest? When a input pin on the nRF is pulled down/up, you make sure that the nRF disables the SPI and that the pins are set to the default configuration.

  • Hi thanks for the suggestion. Do you have any idea why as to why the problem still exists even when the board is not powered? Because originally I was thinking of putting a diode on Vdd to stop C232 from powering the board, so when it is downloading data only the nand flash is powered.

  • Leaking power into a pin while the power is off could potentially cause the current to leak into VDD via internal clamping diodes on the pin (or ESD protection diodes). You could potentially be powering the chip through a GPIO, so this should be avoided.

Related