Mark Michael

KL26Z SPI MOSI Idles high

Discussion created by Mark Michael on Jul 20, 2016
Latest reply on Jul 25, 2016 by Hui_Ma

I'm trying to read/write data to a camera module using the SPI interface. The slave generates a response with an arduino but not with the frdm-KL26z. I used an oscilloscope to compare the MOSIs and I found that POL and PHA were 0 in both of them. The only difference was that the Arduino has the MOSI pulled down and the KL26z has it pulled up. I'm using Processor Expert and KSDK 1.3 and I can't find a way to change where the MOSI idles for the KL26z.


Here is the Arduino SCK and MOSI (0x80, 0x55) (receives response)




Here is the Freescale sending the same bytes (no response)Freescale.jpg


In a quick attempt to validate my hypothesis, I wired the CS and and MOSI to digital inputs and output a CS XOR MOSI modified MOSI. The problem with that is that the bytes were shifted (maybe because the CPU had to process them after the original signal is sent?), but I ordered a XOR logic gate that should be here soon.


I would appreciate any suggestions on how to fix this. Although it isn't pictured, I verified that CS is pulled low for the transmission and pulled back up between transmissions. I also double checked that the slave was configured for POL 0 and PHA 0. I also made sure the frequency wasn't too high (it's set to 75khz; the slave can work with up to 8Mhz).