Spark Logic

SPI-3 wires

miki Wed May 18, 2016 10:30 pm

Hi,
I need some help.I want to use 3 wire spi comm with a rf module.
I need to use MOSI pin, bidirectional for write and read .How can I do it ?I want to use HW spi .bitbaging I know to do it.
I have a mini maple board.

Replies

RogerClark Wed Jun 01, 2016 2:23 am

@miki

Can you post your updated code in case anyone else wants to use 3 wire SPI

Thanks

Roger

miki Wed Jun 01, 2016 2:35 am

Yes of course.
How ever I still don’t fully understand why this one it is working at higher speed and previous not.
Maybe somebody can explain.The previous code is easy to explain.

here:
this one enables me DIV2.I tested with DIV2(18Mhz) and working.I can write and read A7105 regs at this speed.

uint8_t _spi_read(){
uint8_t rx=0;
SPI_DISABLE();
SPI_SET_BIDIRECTIONAL();
SPI_ENABLE();
//
SPI_DISABLE();
while(!(SPI2_BASE->SR& SPI_SR_RXNE));
rx=SPI2_BASE->DR;
SPI_SET_UNIDIRECTIONAL();
SPI_ENABLE();
return rx;
}

Sign in to reply