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

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

  

  • Hi,

    I am using hook up wires on my breadboard, so they are approx 2" long.

    I am using the same GPIO for SPIM3 as when I use SPI and SPIM0-2...I just change the config and rebuild and no longer works without capacitor on SPIM3.

    Makes me think there is something diff inside the nrf52840 chip that allows SPIM3 to handle the higher clock speeds (16/32 Mhz), but at the same time also means I need a capacitor, especially when I am making no changes to the hardware each time I switch SPI's.

    What I have not done is test SPIM3 with 16/32 Mhz clock speed yet.  Will do that next...especially as that is why I wanted to use SPIM3.

    Good idea for me to post something on Adafruit forums too.

    Thanks for the response.

  • winneymj said:
    What I have not done is test SPIM3 with 16/32 Mhz clock speed yet.  Will do that next...especially as that is why I wanted to use SPIM3.

     Also test at lower speeds. 

    And can you share an analog scope of the SPIM3 vs SPIM0-2 at 8MHz?

  • Hi,

    I went down to 250 khz and still needed capacitor for SPIM3, but not for other SPI's.

    Will see what I can capture from the scope.  Only problem is that when I connect my scope to MOSI it adds the capacitance back and the SPIM3 works.  Worth a try though.  Will try grabbing that tonight.

    Thanks 

  • If you don't have high drive correctly set for both SCK and MOSI then you will not get reliable operation on SPI3; ideally this should be verified by setting a breakpoint and looking at the PO configuration just before or just after a transfer. Note the following is not going to work:

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

    You have to set high drive for SCK and MOSI after doing the init as the init sets low drive on the pins.

  • Thanks for the information on the high driver strength....although I have set it I will double check just before the transfer to make sure.

Related