SPI - MOSI and MISO Pins are connected - How to set up read command? FIFO

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Not applicable
Dear Community,

On my XMC4800 I have 1 Pin for MISO (4.6) and one Pin for MOSI (3.11). These to lines are connected, because my Slave only has 1 Single Data Line.
I am using a FIFO for data buffering.
Directly after Transmitting a command, I set my MOSI in tri-state.

Pseudocode:

- Setting (3.11) as MOSI Pin
- Send Read CMD
- Set 3.11 Tri-State
- Read Command



I am not sure how to set up the FIFO and the word lengths. Right now I only see my MOSI command on the oscilloscope.

I want to send a byte as a command request and receive a byte from my Slave, but CS has to stay LOW all the time!


What are the right Settings for
SCTR.FLE
SCTR.WLE

TCSR.WLEMD
TCSR.TDSSM
PCR_SSCMode.FEM ?


This how my receive data buffer is configured:
// Define start entry of Receive Data FIFO buffer
USIC2_CH1->RBCTR &= ~(USIC_CH_RBCTR_SIZE_Msk | USIC_CH_RBCTR_DPTR_Msk);
// Set Receive Data Buffer SIZE to 32 and set data pointer to position 64
USIC2_CH1->RBCTR |= ((0x05ul << USIC_CH_RBCTR_SIZE_Pos)|(0x40ul << USIC_CH_RBCTR_DPTR_Pos));
//END OF MISO


My receive Function looks like this right now:
-> Is this correct? Is it OK to put my data in USIC2_CH1->IN[0] ?


static UINT8 disp_u8Data=0;
//Reset receive buffer shift flag (1: A receiver start event has occurred.)
USIC2_CH1->PSCR |= (0x01ul << USIC_CH_PSCR_CRIF_Pos);
static UINT8 disp_u8OUTRBitmask = 0xFF;
disp_u8Data=(USIC2_CH1->OUTR & disp_u8OUTRBitmask); //
//Add received data to FIFO buffer
USIC2_CH1->IN[0] = disp_u8Data;


Thank you very much and best regards!
Peter
0 Likes
0 Replies