cancel
Showing results for 
Search instead for 
Did you mean: 

I can't read BYTEs from the QUAD SPI using the indirect mode.

Glenn Rosendahl
Associate II

I'm using the following code to read from the QUADSPI data register.

(uint8_t) * dptr;

*dptr++ = QUADSPI->DR;

What I get is it reads 4 BYTEs from the FIFO and only returns the lowest Byte in memory pointed to by dptr. The ref manual says you can read Bytes, Half Words, and Words. Also says you have to read just the lowest byte from the DR[31..0] ..

I'm sure it is simple any help appreciated.

Thanks!

2 REPLIES 2

At the moment it is doing a 32-bit read of DR, if you needed it to read 8 or 16-bit from it you'd need to cast to an appropriate width pointer.

ie

*dptr++ = *((uint8_t *)&QUADSPI->DR);

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Glenn Rosendahl
Associate II

Thank you Sir!

Is there a reference that explains these cast rules by example would be nice.

Thanks again.