AnsweredAssumed Answered

SPI 3 wires

Question asked by Philippe Calmettes Employee on Jan 22, 2015
Latest reply on Jan 23, 2015 by Hui_Ma

Hello ,

Is it possible to get SPI 3 wires driver on the Freedom K46.

I Look at the documentation and only see information about the 4 wires spec.

I already implemented the 4 wires and look at the 3 wires possibility( in 3 wires the MOSI line is bidirectionnal and during reading the data is put on the MOSI line).

 

My actual SPI 4 wires readings :

 

byte SpiReadReg2(uint8_t addr) {

    MySPIPtr = SM1_Init(NULL);

    SPI0_BR=0x22;

    dataforspi.spi_addr = addr+128;

    dataforspi.spi_val = 0XFF;

    SPI_CS2_ClrVal();

    // send and receive of address and value

    (void)SM1_ReceiveBlock(MySPIPtr, &dataforspi, sizeof(spiData));

    (void)SM1_SendBlock(MySPIPtr, &dataforspi, sizeof(spiData));

    // wait for receiving of the block of data

    while(!SM1_GetBlockReceivedStatus(SM1_DeviceData)){};

    SPI_CS2_SetVal();

    return dataforspi.spi_val;

}

 

Thanks.

Outcomes