cancel
Showing results for 
Search instead for 
Did you mean: 

Image reading from uSD card vs USD pen drive

Ricko
Associate III

Hi,

I have to read both image files(BMP and JPEG) and also text files from either uSD or USB pen drive. But - despite having written quite a bit of code through the years - I have never developed any code that does that specifically. nor do I have previously used the STM32 or STM32 tool chain.

 

Just a couple of questions:

1) which one is easier, faster and simpler to implement? The uSD card or the USB pen drive?

2) would it be better / easier to use also FreeRTOS or not?

3) What are the libraries to install/use? Are there any code samples?

 

Any additional pointers are also welcomed! 🙂

 

Thank you very much 🙂

1 ACCEPTED SOLUTION

Accepted Solutions
SHs
ST Employee

Hello @Ricko ,

Using uSD card is easier to implement, typically, microSD cards are interfaced through the SPI or SDIO protocols, which are well-supported by the STM32 hardware and software ecosystem. Also it is faster to set up, the STM32CubeMX tool can help you quickly configure the necessary hardware peripherals. Additionally the FatFs library is commonly used for file system operations on SD cards and is relatively straightforward to integrate. Whereas for USB, it requires handling the USB host stack, which can be more complex than SPI or SDIO. You'll also need to configure the USB host and class drivers, which can take more time.

You can refer to this instructional video on YouTube for FatFs, also this video for FreeRTOS. If your application is simple and doesn't require multitasking, you might not need FreeRTOS. However, for more complex applications, an RTOS can be beneficial.

Within STM32Cube MCU Packages , you'll find a variety of related applications depending on your utilized STM32 series.

Hope this may be helpful.

Please mark my answer as best by clicking on the “Accept as solution" button if it fully answered your question. This will help other users find this solution faster.

Thanks for your contribution.

View solution in original post

7 REPLIES 7
urbito
Senior

- Both uSD or USB drive would have same "difficult". 

- Would you use FreeRTOS for anything else? if you are only reading content from uSD or USB drive, easier to dont.

- You can have a look in CubeIDE, create a new project from examples, you can choice a STM32 example that does uSD or USB drive read.

 

Greetings

Thank you @urbito ! 🙂

Just to get a feel for it, how long do you think it would take to write some simple code (using ST libraries) to read an image file? I have coded before but never with uSD or USB.

s it just a few lines like with the old serial ports on PCs like Open File, Read and Write? Or is it a more complex process with many things to check to write solid code?

 

Thank you again!

it would for sure be "few lines" with something similar to PC, since you would use a library Called "FatFS". Just have a look on the ST Examples and you would get it relative quick 🙂

 

Greetings

Thank you @urbito  🙂

Andrew Neil
Evangelist III

You can get USB "pen drives" which take a uSD card; eg,

AndrewNeil_0-1716473144910.png

So you could just develop a USB MSC Host - and use one of those to provide the uSD Card support ...

 

Thank you @Andrew Neil  🙂

SHs
ST Employee

Hello @Ricko ,

Using uSD card is easier to implement, typically, microSD cards are interfaced through the SPI or SDIO protocols, which are well-supported by the STM32 hardware and software ecosystem. Also it is faster to set up, the STM32CubeMX tool can help you quickly configure the necessary hardware peripherals. Additionally the FatFs library is commonly used for file system operations on SD cards and is relatively straightforward to integrate. Whereas for USB, it requires handling the USB host stack, which can be more complex than SPI or SDIO. You'll also need to configure the USB host and class drivers, which can take more time.

You can refer to this instructional video on YouTube for FatFs, also this video for FreeRTOS. If your application is simple and doesn't require multitasking, you might not need FreeRTOS. However, for more complex applications, an RTOS can be beneficial.

Within STM32Cube MCU Packages , you'll find a variety of related applications depending on your utilized STM32 series.

Hope this may be helpful.

Please mark my answer as best by clicking on the “Accept as solution" button if it fully answered your question. This will help other users find this solution faster.

Thanks for your contribution.