Skip to main content
Rick MC
Associate III
Jun 6, 2018 12:23 PM UTC
Solved

QSPI: Write/Read strings from QSPI memory

Posted on June 06, 2018 at 14:23

Hello,

I implemented some functions to read and write the QSPI memory by using functions HAL_QSPI_Transmit() and HAL_QSPI_Receive() provided by the libraries.

Everything works fine. I just wonder how I can write and read strings using these functions.

I want to write:

   char myString[100][50];

but the above functions have a uint8_t as an input!

Is there any way to do so, other than passing a single character at a time?

Thanks,

#read #strings #write #qspi
This topic has been closed for replies.
Tesla DeLorean
Tesla DeLoreanBest answer
Guru
Jun 6, 2018 5:21 PM UTC
Posted on June 06, 2018 at 17:21

Use a cast?

char myString[50];

BSP_QSPI_Write((void *)myString, Address, sizeof(myString));

BSP_QSPI_Write((uint8_t *)&myString[0], Address, sizeof(myString));

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..

7 replies

Tesla DeLorean
Guru
Jun 6, 2018 2:56 PM UTC
Posted on June 06, 2018 at 16:56

>>Is there any way to do so, other than passing a single character at a time?

Clearly there would be a means to achieving it.

STM32Cube_FW_F7_V1.11.0\Drivers\BSP\STM32F769I-Discovery\stm32f769i_discovery_qspi.c

BSP_QSPI_Write(Buffer, Address, Size)

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
Rick MC
Rick MCAuthor
Associate III
Jun 6, 2018 5:16 PM UTC
Posted on June 06, 2018 at 17:16

Thanks!

But how can I put my string (let's say char myString[50]) inside the Buffer in 

BSP_QSPI_Write()?

This function only accepts uint8_t as a buffer and I have a chars!

Tesla DeLorean
Tesla DeLoreanBest answer
Guru
Jun 6, 2018 5:21 PM UTC
Posted on June 06, 2018 at 17:21

Use a cast?

char myString[50];

BSP_QSPI_Write((void *)myString, Address, sizeof(myString));

BSP_QSPI_Write((uint8_t *)&myString[0], Address, sizeof(myString));

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..