2021-08-03 02:06 AM
HAL_Delay (500);
fresult = f_mount(&fs, "/", 1);
if (fresult != FR_OK)
Serial_PutString ("ERROR!!! in mounting SD CARD...\n\n");
else
{
Serial_PutString("\n\r SD CARD mounted successfully...\n\n");
fresult = f_open (&fil, "zephyr_20210506_nbiot_quad_12ec59.bin", FA_READ);
result = Ymodem_Transmit(&fil, (const uint8_t*)"zephyr_20210506_nbiot_quad_12ec59.bin", 5601949);
My requirement is to pass the start address of the file stored in SD card to the function "Ymodem_Transmit" and transfer file using Y MODEM protocol to some other microcontroller connected to STM32. I used SD card because the above mentioned file is of large size which cannot fit in internal flash of STM.
Remaining small files i am putting in flash and reading by giving the address in flash as below
result = Ymodem_Transmit((uint8_t*)APPLICATION_ADDRESS, (const uint8_t*)"sbl_7243i_v1.0_test.bin", size);
where #define APPLICATION_ADDRESS (uint32_t)0x08100000
Complete implementation is given in the attached code.
I am not getting the starting address of file by giving like this.
result = Ymodem_Transmit(&fil, (const uint8_t*)"zephyr_20210506_nbiot_quad_12ec59.bin", 5601949);
Is by passing &fil will get the address of file stored in SD card?
Or otherwise what i need to get access the file in SD card.
Waiting for the reply. Please help...
Thanks,
Jestina
Solved! Go to Solution.
2021-08-03 03:05 AM
Hello
"fil" is a file descriptor, it is not an address pointing on the file's data.
You have to use "f_read" function after "f_open" to get your data.
2021-08-03 03:05 AM
Hello
"fil" is a file descriptor, it is not an address pointing on the file's data.
You have to use "f_read" function after "f_open" to get your data.
2021-08-03 04:49 AM
Hi,
Thanks for the answer.
#define BUFFER_SIZE 5601949
unsigned char buffer[BUFFER_SIZE];
fresult = f_read (&fil, buffer, f_size(&fil), &br);
My file is of size 5601949. When i compiled the code, I am getting an error like "region `RAM' overflowed by 5490600 bytes"
How can I solve the issue and store the received data?
Jestina
2021-08-03 04:59 AM
I need the complete data all in once.
2021-08-03 05:01 AM
You're exceeding the maximum chip memory.
You cannot store all your file in the STM32 memory, unless you have external RAM.
You have to declare a smaller array and make a loop to read and transmit the file piece after piece.
2021-08-03 05:14 AM
OK Thank you.