AnsweredAssumed Answered

Transmit 32 Bit via SPI

Question asked by Pascal Schroeer on Jul 17, 2014
Latest reply on Jul 18, 2014 by EARL GOODRICH

Hi at all,


I have got a little question to the SPI configuration. I'm using a MK10DX128VLH7 cpu and would like to communicate

from the cpu to an external AD converter. So there is no problem, I have initialised the spi and there is a function to

transmit  and to receive bytes from the ADC. Now my question:


I have to send 32bit to the adc. So I have to transmit 16Bytes two times. Thats works, but between the last clock

of the first 16bits and the first clock of the second 16bits there is only a very small gap (low time of the clock).

(pls. see the logic diagramm). Does anyone know, how to fix this problem? I don't want to work with external

delay functions... that must be possible, I think..


Thanks a lot!






void SPI_init(uint8_t module, uint8_t mode)


    SPI0_MCR = 0x00

                      | SPI_MCR_MSTR_MASK

                      | SPI_MCR_DCONF(0x00)

                      | SPI_MCR_PCSIS(0x01)

                      | SPI_MCR_DIS_TXF_MASK

                      | SPI_MCR_DIS_RXF_MASK;


    SPI0_CTAR0 = 0x00

                         | SPI_CTAR_FMSZ(0x0F)

                         | SPI_CTAR_BR(0x08);



void SPI_transmit_byte(uint8_t address,uint16_t data)


    SPI0_PUSHR = data

                         | SPI_PUSHR_PCS(0x01)

                         | SPI_PUSHR_CONT_MASK;     //keep the cs low


    while(!(SPI0_SR & SPI_SR_TCF_MASK));


    SPI0_PUSHR = data

                         | SPI_PUSHR_PCS(0x01);


    while(!(SPI0_SR & SPI_SR_TCF_MASK));









                                                                                       Here is the fault!