SPIM #3 MOSI must be tied to ground via capacitor to work

Hi,

I am using an Adafruit nrf52840 Feather board and have been having a problem with SPIM instance # 3.

I have the board connected to a display module and have been successful in using SPI #0-2, and SPIM instances 0-2, without changing the hardware and just switching the config and building.

When I use SPI(#0-2) I can successfully initialize the display, with no change of hardware or pins.

When I switch to use SPIM(#0-2) I can successfully initialize the display, with no change of hardware or pins.

As soon as I configure to use SPIM #3, with no change of hardware or pins, it fails to initialize the display!

I started research and use my oscilloscope to see what was happening on the MOSI pin and as soon as I attached the probe it started to work....I removed the probe and it stopped working again.  I then wondered if it could be capacitance, so I connected a 15pF capacitor from MOSI -> ground and it began to work.

I had the speed set at 10Mhz and so I dropped it to 250khz in case was a speed problem, and it still needs the capacitor when using SPIM #3.

Does anyone have a clue what it going on?

Any help is appreciated.

Thanks

Mark

  

  • That is very strange, usually the failure mode is too much capacitance on an SPI bus. 

    Try setting high driver strength on the GPIOs for SCK, MOSI, and MISO, prior to initializing the SPI driver.

  • Hi,

    I set the SCK and MOSI lines to high drive (not using the MISO line) and made no difference.

    I thought I would try to take a look at the waveform with and without the capacitor and see what effect it had, but when I connect the oscilloscope probe to the MISO line it works again, so that does not help me.

    What I find strange, as I said in the orig post, is that all works well, even at max 8Mhz when using SPI and SPIM#0-2, but as soon as I configure of SPIM#3 the capacitor is needed, even at lower speeds.

    Is there any kind of testing I can do without power to the device....basic checks on the wiring?  I looked at my custom board I use to interface to the display and nothing jumps out at me.  The SPI and MOSI lines go direct to the display and cross over the reset line on the ground plane. Image of board is attached.

      Any help diagnosing the problem is appreciated.

  • If using a write-only SPI display then it is not clear why there is even a MISO pin; perhaps try not defining what is probably a floating pin in this design, as un-terminated pins defined as SPI MISO can generate all types of nuisance when assorted clocks are bashing about on nearby pins, and the capacitor is simply reducing that interference. If using Nordic drivers change the pin to disconnected thus:

    #define NRFX_SPIM_MISO_PIN    NRFX_SPIM_PIN_NOT_USED // not used

    if using direct hardware control instead use

    PSEL.MISO = 0x80000000;  / low-level pin disconnected
    ie same as
    PSEL.MISO = SPIS_PSEL_MISO_CONNECT_Msk;
    or
    PSEL.MISO = NRF_SPIM_PIN_NOT_CONNECTED; // 0xFFFFFFFF
    
    These all set the MS-Bit (bit 31) to '1'

    Be careful not to mix these; NRFX_SPIM_PIN_NOT_USED is defined differently - 0xFF, which only works with the driver not the pin control register.

  • Sorry guys I have been getting confused when writing this between my MISO and MOSI.....the problem is with the MOSI pin needing a capacitor....the MISO pin is not connected/not used.  I will check my sdk_config settings to make sure I have correctly disabled the MISO pin.

  • Given that you needed to add capacitance you might have an issue with ringing due to a highly inductive load, or other kinds of EMI.

    Are you using particularly long leads or something? 

    Do you use the same GPIOs for SPIM3 as SPIM0-2? 

    Do you see the same problem on the nRF52840 DK?

    I suggest you ask on the adafruit forums as well. There might be known issues with their layout with regards to GPIOs.

Related