Bare metal USB MSD FATFS example

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Bare metal USB MSD FATFS example

Jump to solution
1,158 Views
burhanhagi
Contributor III

I am trying to mount USB flash disk to my custom IMXRT1176 board. I aim to list all .mp3 binary files in USB stick and later then try to play those files randomly. 

I found only one example in SDK named "evkmimxrt1170_host_msd_fatfs_bm_cm7" related with FATFS MSC. However, in above example there is a simple OS used for it, named OSA. But I do not want to use operating system. I need the same example but using only with bare metal. 

Is it possible to share with me one example .zip file?

Below is the screenshot of USB folder in MCUXpresso IDE for IMXRT1166;

burhanh_0-1683902821673.png

Below is the screenshot of USB folder in SW4STM32 IDE for STM32F769;

burhanh_2-1683903025164.png

As per my understanding, usb folder in MCUXPresso IDE is based on running over Operating System. But as you see, in STM32F769, USB folder is based on bare metal, no OS.

I tried to download USB and FATFS stack from online SDK Builder. But every time I download it, it is with OAS coded. I could not find bare metal FATFS USB MSC Class folder in Middleware Section. 

 

 

0 Kudos
Reply
1 Solution
1,076 Views
jingpan
NXP TechSupport
NXP TechSupport

Hi @burhanhagi ,

 USBHostTaskFn is used to receive interrupt message. When interrupt comes, it register a message to OSA. USBHostTaskFn check this message and parse the incoming command. If you don't like this mechanism you just make your own massage channel.

 

Regards,

Jing

View solution in original post

0 Kudos
Reply
4 Replies
1,098 Views
jingpan
NXP TechSupport
NXP TechSupport

Hi @burhanhagi ,

OSA is not a operation system. It is a middle level between OS and baremetal software. With this level, the baremetal example can port to OS easily.

 

Regards,

Jing

0 Kudos
Reply
1,091 Views
burhanhagi
Contributor III

Hi @jingpan, There is 2 functions in the main function. USB_HostMsdTask(g_MsdFatfsInstance) function is the one what I want to add. However, the first function USBHostTaskFn(g_HostHandle) is related with OSA. See the below please;

burhanh_0-1684134510153.png

USBHostTaskFn(g_HostHandle) inside;

burhanh_1-1684134713943.png

 

burhanh_3-1684134803193.png

As you see above, that function calls OSA_EventWait(...). 

When I comment out the USBHostTaskFn(g_HostHandle) function in the main while loop, the code does nothing.I need the program to execute with only USB_HostMsdTask(g_MsdFatfsInstance). However, without USBHostTaskFn(g_HostHandle) function, I could not achieve it. What could I do? How could I weed out the unwanted OSA lines? Because all usb->host->class->.. files was constructed based on this.

burhanh_4-1684134901421.png

 

 

 

0 Kudos
Reply
1,077 Views
jingpan
NXP TechSupport
NXP TechSupport

Hi @burhanhagi ,

 USBHostTaskFn is used to receive interrupt message. When interrupt comes, it register a message to OSA. USBHostTaskFn check this message and parse the incoming command. If you don't like this mechanism you just make your own massage channel.

 

Regards,

Jing

0 Kudos
Reply
1,062 Views
burhanhagi
Contributor III

Thank you @jingpan 

0 Kudos
Reply