5 years, 7 months ago.  This question has been closed. Reason: Off Topic

Basics on SPI: signal on MISO without connection to anywhere

Hi everyone, I am trying to connect my STM32F413 Discovery Board to a MAX30003 ECG but without any success. So I checked the SPI signals with a scope and discovered that I measure a signal on the MISO line as soon as I use a write command. All pins (MISO, MOSI, SSL, SCLK) are only connected to the scope! I assume the MISO should be constant low (0V) without connection, but I measure a stable 3.3V signal (i.e. 0x15). So what have I done wrong? After several days searching I would be thankful for some hints to find my mistake…

Thanks, Jens

  1. include "mbed.h" SPI device(SPI_MOSI, SPI_MISO, SPI_SCK); DigitalOut chipselect(SPI_CS);

int main() { int i = 0; while(1) { chipselect=0; device.write(i++); chipselect=1; wait_ms(50); } } (I am using chipselect as my sope trigger)

There is no reason why an unconnected pin should be at 0. In the situation you describe you have a 50/50 chance of always 0 or always 1. Either of them is normal.

The most likely reason if that the internal pullup on the MISO pin is enabled. It would be equally valid to enable the internal pulldown.

Or it could be that no pull up/pull down is enabled and the pin is truly floating in which case you have even chances that it's 0, 1 or floating somewhere in between at random.

Digital inputs should never be left floating, they should always be pulled to a defined level either by internal or external means.

posted by Andy A 14 Sep 2018

Hi Andy, thanks for the answer. I tried external pullup and pulldown resistors without any change. By the way, the output "signal" has the same value since days (hex:15) should'nt it be rondom then? Could this pin be used by any other function of the discovery board? How do I set an internal pullup on the MISO pin - I would try this... Best, Jens

posted by Jens Kampmann 14 Sep 2018