Hello,
My customer needs a solution of a bootloader which has to be capable of updating the application firmware through a USB Flash stick that holds the .srec file.
But, unfortunately, it seems that KBOOT supports USB device MSD, but not USB host MSD.
Do you have plans to launch a version that supports USB host MSD?
If you don't, so the only possible way is to merge SDK v. 2 USB Host MSD FatFs demo code with freedom bootloader code which is available in open source code within KBOOT v. 2 package.
We haven't found any tutorial or documentation on how to do that.
We found that all the SDK v. 2 (for KDS) drivers are already included in the demo as well as their paths in Properties / ARM Compiler Includes, except for USB host files. Actually, USB host folder is not included in KBOOT package. Maybe we can just copy this folder to KBOOT usb folder and link to the files in the project, but, to be sincere, I don't know the conflicts and difficulties we may find on the way.
That is why we are looking for some guidance to go the best way in this process.
Thanks and best regards,
Marco Coelho
Applications Engineer
Siletec Eletronica
Hi Marco
Answering your question
Do you have plans to launch a version that supports USB host MSD?
No, unfortunately, at the moment there is not plan that KBOOT supports USB Host MSD.
There is not guide that I could give you to could implement that code that you require, the only information for KBOOT available is located in the path <NXP_Kinetis_Bootloader_2_0_0>\doc.
Sorry for the inconveniences that this may cause you.
Best Regards
Jorge Alcala
Thanks for your response, Jorge
I really expected that NXP could launch a new version of KBOOT that supports USB Host MSD, or at least a guide that could help the customers to add this functionality.
I have a customer interested in including this to his project now and we have to point another way to him.
Can't you give us an alternative solution?
Thanks and best regards,
Marco Coelho
Hi Marco
Although the best approach to your needs is to migrate this project (TWR-K70 MSD HOST Bootloader based on AN4368 source code ) to your part number, I would strongly recommend to create this USB Host bootloader by using KBOOT as reference, because AN4368 uses USB BareMetal stack (4.1.1) which is now obsolete and no longer recommended for future designs.
Maybe you could check Kinetis Bootloader, it offers an USB MSD Device bootloader which could serve as reference for your Host project.
Best Regards
Jorge Alcala
Thank you for the information, Jorge
I think this will really be the best way to go in this case.
I took a quick look at the code you recommended me to refer and something doesn't make any sense to me.
The following functions read s19 file data from USB memory stick and write it to K70 Flash memory, respectively, and they are called this way:
returnCode = f_read(&fp, buffer,BUFFER_LENGTH,&size);
result = FlashApplication(buffer,size); /* parse and flash an array to flash memory */
I can't understand why the buffer length is 1024 bytes, instead of 4096 byes, since FlashApplication is supposed to write a sector (which is 4096 bytes).
Marco Coelho
Hi Marco
It is because f_read read the information of the .s19 record, but this information needs to be parsed in order to get what you actually need to write in your flash, so, even if you read 1024 or 4096, it doesn't mean that it will write this 1024 or 4096 into flash, if you go inside FlashApplication you will verify that it has a switch (filetype). Yes, you can write a sector of 4096, but this example code use the Program Phrase command, so it program 8 bytes in a program flash block.
Have a great day,
Jorge Alcala
Hello, Jorge
You are sure. I misunderstood the code. After double checking it, now it gets clear to me.
Now I took KSDK v2 "host_msd_fafs_freertos" demo code and tried to open a .srec file from a USB stick, but "fopen" returns me error "FR_INVALID_NAME (#6)".
My "fopen" function call in "USB_HostMsdFatfsTest" function is like that:
fatfsCode = f_open(&file,"1:/arquivo.srec", FA_WRITE | FA_READ);
Where am I going wrong?
Have a great day!
Marco Coelho
Hello
I'm also interested by an USB Host bootloader on different Kinetis target
I already used the TWR-K70 MSD host bootlader on a K70 and port to a K60 but like said, this is obsolete.
Then there are any existing solution for have a MSD host bootloader on other kinetis than K60/K70?
Thank