7 years, 9 months ago.

mbed SPI mode

Hi all, i've got a question about mbed SPI driver: if i change the peripheral working mode from to 0 to 2-3 (CPOL 1), the SCK pin shouldn't go high?

Thanks in advance.

1 Answer

7 years, 9 months ago.

The CPOL polarity defines the SCK level during idle periods: either high or low.

See here.

When you change the mode the pins should activate the new mode immediately.

Apparently there's something wrong.

I create a SPI object, change mode to 3 and write a cmd.

This is what i see on the bus /media/uploads/lucacirani/capture.jpg SCK stays high only after the first write.

I'm on frdm-k22f.

posted by User Name 14 Jul 2016

What value was actually written out? if the value was 0x80 then those waveforms would make sense. I would guess that the clock is "lazy" meaning it only updates when a transition is required and we're not seeing the initial falling edge at t=-0.5bit because the clock was already low.

posted by Oliver Broad 14 Jul 2016