PSoC 4 communicate with FRAM

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

cross mob
Abel_W
Level 3
Level 3
Distributor - Intron(GC)
10 likes given 100 sign-ins 25 replies posted

hi friends

  i have a trouble when i am using  SPI to communicate with a fram .I would like to know why using spi communication must use a delay function after sending a byte and before reading it, if no delay function is used, there will be a shift.(0x01,0x02,0x03 will become 0x00 0x01 0x02).And the delay time is different, the shift is different

wangjiazheng_0-1674028463604.png

 

0 Likes
1 Solution
Arpit_S
Moderator
Moderator
Moderator
250 replies posted 100 solutions authored 250 sign-ins
0 Likes
3 Replies
Arpit_S
Moderator
Moderator
Moderator
250 replies posted 100 solutions authored 250 sign-ins

Hi @Abel_W ,

 

Can you please refer to this CE

https://www.infineon.com/dgdl/Infineon-CE220499_Interfacing_the_SPI_F-RAM_with_PSoC_4-Code%20Example... 

 

Thanks 

Kind Regards

Arpit Srivastav

0 Likes
Abel_W
Level 3
Level 3
Distributor - Intron(GC)
10 likes given 100 sign-ins 25 replies posted

hi 

thanks for your reply, i already konw what i want asking for at this ce

best regards

0 Likes
Roy_Liu
Moderator
Moderator
Moderator
5 comments on KBA First comment on KBA 10 questions asked

I guess the reason is you need to make sure the TX was completed -  the data was written to FRAM(by checking RX buffer status) before reading the data from FRAM. 

/* Start transfer */
SPIM_SpiUartWriteTxData((uint32) wrBuf[i]);

/* Wait for the end of the transfer. The number of transmitted data
* elements has to be equal to the number of received data elements. */
while (PACKET_SIZE != SPIM_SpiUartGetRxBufferSize());

/* Clear dummy bytes from TX buffer */
SPIM_SpiUartClearTxBuffer();


/* Read data from the RX buffer */
tmpBuffer[i] = (uint8) SPIM_SpiUartReadRxData();

 

Roy Liu
0 Likes