Spi189 weird behaviour on IMP001

Hello,

I am performing tests with the SPI of my IMP001, and I had weird results. So I decided to debug the code with my Logic Analyzer by Saleae. At the end I came up with a program with a few lines of code and a results that I’m not sure if it’s normal for the IMP001 or not.

The program has the DEVICE side only, configures the spi189 and uses the pin 2 as CS signal for the SPI slave:

// Hardware setup
// CS pin setup
hardware.pin2.configure(DIGITAL_OUT_OD_PULLUP);

// SPI configuration
hardware.spi189.configure( SIMPLEX_TX | MSB_FIRST | CLOCK_IDLE_LOW, 1000);

function csTest() 
    {
    hardware.pin2.write(0);
    hardware.pin2.write(1);
    }
    
csTest();  

And what my LA shows after it trigs on the CS channel is this:

Even if the spi is not sending any information the MOSI is sending data and the clock seems to replicate the same behaviour. Shouldn’t these signals hold on until a write or read operation is performed?

Is there something wrong I miss? Unfortunately there aren’t that many examples on the use of the SPI so I am not sure if I am doing right or wrong. Can you help me?

Thank you!

I had something like that happen to me today. Turned out I had the logic analyzer source on demo input. That was on a UART connection.

It is worth a check - at the top of the software does it say something like “connected”?

are you sure there’s nothing else connected to the SPI bus driving those pins ? This is no SPI signal pattern.
The program you show above does nothing except generating the 1-0-1 spike you see on channel 3. It definitely doesn’t send out any data on the MOSI or CLK pins. Just configuring the device for SPI189 is not creating actual signals.
BTW, if you actually want to read or write to SPI, the CS needs to stay low for the whole duration of the read or write cycle, not just a spike at the beginning…
BTW2, it is better to use external pullups instead of the internal ones. That way you avoid uncontrolled behaviour during startup.

Also, check the ground wire on the saelae (the grey one) is connected to imp ground. Those pulses appear to be about 60Hz, which would just be floating lines picking up AC.

Hello, thank you for your support.

After several tests, I saw what the problem was. THat was a good lesson for me, and maybe it could be for a lot of users. My circuit was very simple and attached to the SPI pins there was only a SPI SRAM 23K256. Nothing else connected to the SPI bus. I has the same results test by test as soon as I had to use the breadboard for another project. I noticed a weird behaviour even in the other project so the question came to my mind. Is it possible that the breadboard is defective?

Boom!

I detached the ground plane, and checked all the rails and I discovered that one of the the ground rails were broken: one of the metal joints was like twisted and broken.

Damn! I have lost so much time figuring out what the problem was :slight_smile: And at the end Hugo, your message made me think about possible broken connections.

SO, EVERYTHING is running and working now like a charm, and the lesson is: don’t make assumptions, if something is weird check even the most stupid thing :slight_smile:

Anyway thank you guys for your help.