2022-02-24 01:59 PM
I am trying to create a custom board that boots from SDcard if an SDcard is plugged in, however, if the SDcard is not plugged in I would like the board to boot from the NAND. I want to do this programmable without the boot switch.
Is this possible? Is there a sample project somewhere or some documentation?
Solved! Go to Solution.
2022-03-04 11:03 AM
Hi @Kevin HUBER
I was actually able to flash the NAND flash using dd as long as I place the images at the same offset as the tsv file. I got stuck on generating the UBIFS image as it is more work than it's worth. For the final design, I will use eMMC since it's much easier to generate an image and to flash it using dd.
As a side note programming, the NAND using the Programmer is not a good solution since it is very slow (about 30min for 300MB). From a manufacturing point of view that is expensive and time-consuming.
2022-02-24 11:39 PM
Hi @cfilipescu ,
you should fuse OTP WORD3. e.g. to define a primary boot source as SD-Card and secondary boot source as NAND. You could probably still have SD-Card present for data storage if no valid FSBL header is present on it.
See https://wiki.st.com/stm32mpu/wiki/STM32MP15_ROM_code_overview#Boot_interface_selection
See also penultimate row of https://wiki.st.com/stm32mpu/wiki/STM32MP15_ROM_code_overview#Boot_device_selection_via_the_boot_pins_and_OTP .
Warning that OTP fusing is permanent.
Regards.
2022-02-25 06:12 AM
Hi @PatrickF ,
So if I understand correctly the following sequence would work for my use case:
Is this correct?
If yes, can the OTP fuses be programmed from the kernel or only from uboot?
Are there any scratch OTP fuses that can be used to test out code?
On the EV1 board is the NAND a device available in the kernel in the default image?
2022-02-25 06:17 AM
My question is also how can I make an image that boots from the NAND? Is there anything different that needs to exist in the device tree?
2022-02-25 06:47 AM
Hi,
yes, this sequence should be ok.
Fuses should be done either with CubeProgrammer (which use uBoot) or directly with uBoot commands/scripts.
Unfortunately, there is no scratch OTP to do trials, you should for instance use sockets on development boards of your products (this is how most customers do).
I assume your talk about NAND for parallel raw-NAND (note: there is no serial-NAND on EV1).
On EV1 Starter package, images for Raw-NAND are provided.
Regards.
2022-02-28 07:45 PM
@PatrickF
I still can't understand how to generate a custom image and flash the NAND using the dd command.
I tried copying the sdcard image over to the NAND but nothing happened when I tried to boot from it.
Is there any documentation?
On the wiki I found something that looks promising but I can't access it:
https://wiki.st.com/stm32mpu/wiki/How_to_add_a_new_parallel_or_serial_NAND_memory_device_in_Yocto
For reference, I am using an EV1 board.
2022-03-04 09:44 AM
Hello @cfilipescu ,
You can't use dd to flash a NAND flash. DD is a tool made to be used with block devices and it realizes the copy block by block.
Which is not the case of a NAND flash that is a RAW device.
On the wiki, you can see the SDCard memory mapping: https://wiki.st.com/stm32mpu/wiki/STM32MP15_Flash_mapping#SD_card_memory_mapping
It is explained that the partitions bootfs, vendorfs, rootfs and userfs use an EXT4 file system.
Which is not the case with the NAND mapping: https://wiki.st.com/stm32mpu/wiki/STM32MP15_Flash_mapping#NAND_memory_mapping
Where these partitions are using UBIFS.
UBIFS is filesystem made to work on top of RAW flash and has nothing to do with block devices -> http://www.linux-mtd.infradead.org/doc/ubifs.html.
So it is not possible to copy the image of your SDCard to your NAND flash.
The page that you do not have access yet explains how to modify yocto to generate the UBIFS part. This page is in review and will be available later.
But the UBIFS part is only one part of the NAND mapping.
To flash the NAND device, you have to use the STM32CubeProgrammer: https://wiki.st.com/stm32mpu/wiki/STM32CubeProgrammer_flashlayout#NAND_Flash_memory_with_FIP
As explained by Patrick in its previous message, ST provides in the Starter Package for EV1, a RAW-NAND tsv and the related binaries.
If you haven't fuse the OTP yet, I advise you for your test, to populate the SDCard with STM32CubeProgrammer and the sdcard tsv layout then to populate your NAND with STM32CubeProgrammer and the nand tsv layout.
Then you can use the boot switches to verify that everything is ok and that your two sources are booting.
Once you are sure about your setup, you can fuse OTP primary to Sdcard and secondary to NAND.
Hope it helps,
Regards,
Kevin
2022-03-04 11:03 AM
Hi @Kevin HUBER
I was actually able to flash the NAND flash using dd as long as I place the images at the same offset as the tsv file. I got stuck on generating the UBIFS image as it is more work than it's worth. For the final design, I will use eMMC since it's much easier to generate an image and to flash it using dd.
As a side note programming, the NAND using the Programmer is not a good solution since it is very slow (about 30min for 300MB). From a manufacturing point of view that is expensive and time-consuming.
2022-03-07 12:22 AM
Hello @cfilipescu ,
Yes, you are right the CubeProgrammer is a tool for development purpose, it is not made for mass production
ST recommend to use the ST partner solution from Elprotonics : the gangflasher-st with
https://www.elprotronic.com/pages/gangflasher-st.
Regards,
Kevin
2022-03-17 02:12 AM
Hello @cfilipescu ,
In order to give better visibility on the answered topics, please click on 'Select as Best' on the reply which solved your issue or answered your question. See also 'Best Answers'
Regards,
Kevin