Тёмный
No video :(

External loaders for SPI flash: a "standard" version 

Mauro De Vecchi - Bluewat
Подписаться 935
Просмотров 7 тыс.
50% 1

Опубликовано:

 

28 авг 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 75   
@johnwatts3339
@johnwatts3339 9 месяцев назад
Hi, Excellent video on creating External Loaders for STM32!
@bluewat
@bluewat 9 месяцев назад
Thank you!
@SEEMERIDECOM
@SEEMERIDECOM 11 месяцев назад
This is awesome!! I'm designing a board that uses an STM32H723 and (2X) W25Q128JV NOR Flash in a Dual Quad config using the OCTO-SPI. SO, my config will be a bit more complex, but I think I will be able to use these examples to get started on the large task. Thank you so much for sharing.
@bluewat
@bluewat 11 месяцев назад
Hi @seemeridecom, interesting project. It would be interesting to know the performance of this architecture. Could it be interesting, in some cases (heavy data handling), to store program over OSPI keeping data on the internal flash?
@SEEMERIDECOM
@SEEMERIDECOM 11 месяцев назад
@@bluewatThe project I'm building will be a larger HMI and I'm not 100% sure of the size of all the assets or code. The processor has 1MB of internal flash and I know I'll overrun that for sure. My plan is to put as much code in that internal flash and most all the assets (graphics/fonts) in the 32MB. I think with having them set up at Octo SPI, they should be pretty fast. Also, if I overrun the 32MB, I can always go larger. This will be a product that I want to release new firmware to my customers via download and they can install using a USB drive. I may also leverage an internal SD FLASH for custom user backgrounds and such.
@Bulent2k
@Bulent2k Год назад
An educational and beautiful video.
@bluewat
@bluewat Год назад
Thanks, Bluent2k.
@kevinperillo
@kevinperillo Год назад
Nice Video and great implementation!
@bluewat
@bluewat Год назад
Thank you!
@lavifriedman7434
@lavifriedman7434 9 месяцев назад
Great example! Thank you
@bluewat
@bluewat 9 месяцев назад
👋
@blcouz
@blcouz 11 месяцев назад
Why did you have to redefine the hal functions (Hal_GetTic IncTick ...) in the Loader.c file? What's the reason for this?
@bluewat
@bluewat 11 месяцев назад
uC calls the external loader having disabled all interrupts. So, systick also is disabled and functions like HAL_InitTick(), called in initialization, would hang. That's why they are redefined. That's explained somewhere in the ST documentation indicated in the video desctiption. Library (in some cases: for instance resetting and initializing flash chip) needs some delays: I left the library calling HAL_Delay() so, when it is normally used in a project, it will use the system timer. While I redefined it here, making it working with no systick.
@blcouz
@blcouz 11 месяцев назад
@@bluewat thanks
@bluewat
@bluewat 11 месяцев назад
👋@@blcouz
@electronic-ebox6403
@electronic-ebox6403 5 месяцев назад
hi, thanks for video. i followed steps you shows. i am using w25q64 chip. in program Flash_init sims to be working well but at Flash_chiperase goes into infinite loop it stuck in busy flag. what is the problem?
@bluewat
@bluewat 5 месяцев назад
That's strange. Writing cycle starts as soon as /CS is driven high and autonomously resets busy bit at the end.
@electronic-ebox6403
@electronic-ebox6403 5 месяцев назад
@@bluewat you are right but in the function Flash_WaitForWritingComplete(); ---> infinite loop at while (buffer[0]& SR1_BIT_BUSY ); . This buffer never receive S1 register value and causes a loop infinity
@electronic-ebox6403
@electronic-ebox6403 5 месяцев назад
@@bluewat is library support w25q64?
@electronic-ebox6403
@electronic-ebox6403 5 месяцев назад
is library support w25q64?
@electronic-ebox6403
@electronic-ebox6403 4 месяца назад
@@bluewat now working... my chip was faulty i replaced with new one and program is working
@DianiAmine
@DianiAmine 7 месяцев назад
Nice demonstration! One question, it's working on IAR workbench also?
@bluewat
@bluewat 7 месяцев назад
Unfortunately I don't know that IDE. In CubeIDE, handling is done by CubeProgrammer, having a sort of plug-in for it. I don't know about IAR
@DianiAmine
@DianiAmine 7 месяцев назад
@@bluewat thank you, I'll try this using cubeIDE
@eyalgoltzman1845
@eyalgoltzman1845 9 месяцев назад
Hello Mauro, Very comprehensive and detailed video, thank you! I'm struggling with building an external loader for an SPI flash for the STM32WLE5, I have the CubeIDE project up and running based on the video but when I connect to the device with CubeProgrammer and try to use the stldr I built I get a message "Error: Data read failed". I tried to take the SPI out of the stldr and only test the init part with blinking a led on my target but I get the same error. When I run the same project in debug configuration from main.c the led is blinking. What could go wrong? Any way to debug it? Thanks
@bluewat
@bluewat Месяц назад
A possible cause and solution is on video about 12kB external loaders
@2wheels
@2wheels 6 месяцев назад
Hi...I have tried implementing this for issi 4MByte memory on stm32h750. It works fine until I tried to program a bin file > 100kByte. Cube programmer shows download failure at segment (0). Any idea what is wrong?
@bluewat
@bluewat 5 месяцев назад
Are you getting error in reading or writing? or both?
@2wheels
@2wheels Месяц назад
I have resolved this issue. Need to change variable quota in z_flash_W25QXXX.c from uint16_t to uint32_t. Many thanks for making this tutorial. 😊
@FlyHIGHSIM
@FlyHIGHSIM 7 месяцев назад
Is it possible to have my external flash memory via SPI having part of my program from the STM32CUBEIDE loaded like if it were the internal flash to carry a few variables?
@bluewat
@bluewat 7 месяцев назад
In principle, yes. But: (1) what you mean referring to "a few variables"? They should be "a few constants". If so: external loader would program flash and, setting up an appropriate driver, "variable/constants" could be read regadless where they are stored: inside or outside uC. (2) Take in consideration the SPI flash speed: what said at point (1) is valid "in principle". External flash is a widely used to store data and software. But not and SPI one. I'm working on a "smaller footprint" version of the external loader. Much smaller. I'll try to set an example of this kind of handling also.
@FlyHIGHSIM
@FlyHIGHSIM 7 месяцев назад
​@@bluewatOh, great!! BTW my interest is basically do stuff with LCD Displays and for other projetcs, working with lookup tables. In this format, if i have a Lookup Table saved in the external memore like this: uint16_t Lookuptable[1000*60] __attribute__((section("ExtFlashSection"))); Can i address in the code calling like this: uint16_t data = Lookuptable[60]; To try to get the data from the Lookuptable[60] (in the pos 60) ? os do i need to get the pointer of the variable + the 60 positions and fetch from the Flash with the library functions?
@bluewat
@bluewat 7 месяцев назад
No, you can't do that with an SPI flash. You have to setup a function handling flash/memory reading and than, using that function, you can forget if the data is stored intertnally or not in the rest of the program.
@FlyHIGHSIM
@FlyHIGHSIM 7 месяцев назад
I was trying to make the external loader for the STM32G0B1CBT6 that has a RAM of 144K. It generates ok, but the issue is that when i try to open in the cube programmer, it shows as unknown and with address 0x0000000 and no name. Any idea of what could be the issue? (I've oppened an issue in the github as well with screenshots)@@bluewat
@ricardorector3080
@ricardorector3080 2 месяца назад
Hello!! Mauro, I have issues with CubeIDE, External Loader. In CubeProgrammer works great, but when i try use it on CubeIDE i cant write, so i dont know whats going on. Could you help me with.
@bluewat
@bluewat 2 месяца назад
CubeIDE and CubeProgrammer use THE SAME modules so you should easily detect the error: your EL is good (!), that's just a CubeIDE project problem. My 2 cents is: (first hypotesis) did you unselect "verify" in CubeIDE EL properties? If yes I see only (second one) a linker script problem. But it is not easy from here helping you much more than this.
@ricardorector3080
@ricardorector3080 Месяц назад
@@bluewat Thanks for your help!!! Yes the verify is unselected. i'm using ST-Link-V3Set.
@ricardorector3080
@ricardorector3080 Месяц назад
​@@bluewatOk after checking all, I could fix it. And now is working.
@bluewat
@bluewat Месяц назад
Well done!
@iacacch
@iacacch 4 месяца назад
what about if instead of a Flash memory I have an FPGA with SPI in passive mode? Would that work?
@bluewat
@bluewat 4 месяца назад
I'm not sure, but it shouldn't be difficult to adapt the library to another type of communication. As you can see, Loader_Src.c makes calls to a library handling SPI communication through simple functions: Flash_Read(), Write(), Clear(),...
@iacacch
@iacacch 4 месяца назад
I agree on that, I don’t see why it should not work. I will try!
@bluewat
@bluewat 4 месяца назад
Keep in mind that you must avoid interrupts (so, DMA also) as they are disabled exiting the external loader functions
@vishesh6837
@vishesh6837 11 месяцев назад
Hello sir, great video ! I am building a project on stm32 bluepill(f103CT8) and i require to store char arrays and for that i am using winbound flash chip , can give some steps to take care while writing the arrays in the memory and how to read them as i will require to read them mutiple times .
@bluewat
@bluewat 11 месяцев назад
You should find, more or less, all information here in the video (how flash works and how it should be handled), in the related GitHub page (how to setup a project), and in the library function descriptions (how to use the single library functions). If the array is a "const" (written one time only, programming the system and read-only on project runtime) you could get to a very easy flash handling by mapping flash on the uC address space. Not described here until now. I'm working on a new video on this topic.
@saleemshaikh6429
@saleemshaikh6429 4 месяца назад
Hi, Thank you for the Video. I created the .stldr file. But Cube programmer doesn't show Memory Size, page size or Memory type. What could be the reason. I checked and rechecked every step mentioned in your video. Thanks in Advance My device is: STM32G0B0CET6
@bluewat
@bluewat 4 месяца назад
Hi, the easiest part of the answer is that you can be sure that there is something wrong. Not easy is to say what is wrong. That could be also just the structure in Dev_Inf.c. Maybe just a too long string as device name?
@chaos_technology
@chaos_technology 4 месяца назад
In my case, an additional section was created in RAM before the loader functions. STM32G0B0CET6
@blcouz
@blcouz 11 месяцев назад
I don't understand why any writing or reading operation only works once (external loader functions). When I want to make a second transaction, I need to connect to stlink again. What could be the reason for this?
@bluewat
@bluewat 11 месяцев назад
that's strange. What uC are you using? The flash? And what is the clock speed you set in the external loader CubeMX?
@blcouz
@blcouz 11 месяцев назад
@@bluewat I use an eeprom, all functions work. I'm using f446re and 24lc256. Clock speed 180mhz
@bluewat
@bluewat 11 месяцев назад
integrating an I2C eeprom, that's interesting: something I have in mind to test but I haven't yet done. F446re: ok, no problem with ram size. How you use I2C? In some my first tests (SPI) I had some problems with DMA. (Even considering disabled interrupts) Then I used only polling mode. But it was in my first tests: maybe now it could work. Even if I keep working only in polling mode on external loaders. Something else could be in the uC status left, after writing: changes something enabling/disabling "verify" after writing?
@blcouz
@blcouz 11 месяцев назад
@@bluewat I did not use dma or interrupt. I did any delay part as you did. The functions already work stably on their own. The problem is that after performing any operation, I have to reconnect to stlink to perform a second operation. I experienced the same problem about six months ago when I tried to make an external loader with w25q32.
@kursadgulereem
@kursadgulereem 11 месяцев назад
hi, i connected W25Q16 and F411 when i debugging "Flash_TestAvailability" function return 0 always, i cant find where is the problem, pls help me
@bluewat
@bluewat 11 месяцев назад
As you probably have already seen, TestAvailability just reads SFDP record from the flash. That record reports JEDEC information about device connected. Despite the memory size, the record starts with the string "SFDP". That is the only test done by TestAvailability function to see if a chip si connected and communicating. Now, I see only three possibilities: - (the absolutely most likely one) there is something wrong in the communication (SPI port setup and/or wiring). I noted that winbond SPI communication is quite weak (compared to other SPI devices). So, while prototyping over a breadboard, I keep a quite slow speed: below 2mbps. I rise it to higher speed (50mpbs and above) when I move the project over a PCB. Doublecheck wiring and CubeMX configuration - (it is possible, but only if you really belive communication is good) the flash could be damaged? can you test another chip? can you use current chip in another circuit? - (is it possible?) Winbond says that its devices follow Jedec standard since 2011 but not saying how was SFDP record before 2011. Is it possible you have a chip made before 2011?
@kursadgulereem
@kursadgulereem 11 месяцев назад
you are so right, i slowed down mcu speed and it works...😀@@bluewat
@bluewat
@bluewat 11 месяцев назад
👍👍👍You should be able to keep a fast MCU, slowing down only SPI port (working on the "prescaler" parameter of SPI).
@gabrielfienco2531
@gabrielfienco2531 10 месяцев назад
​@@kursadgulereem you are right this worked for me too, not I can program w25q64 using h723, now I want to figure out how to boot from that code.. I think I need to copy it to RAM.. then jump to RAM, right @bluewat?
@chaos_technology
@chaos_technology 9 месяцев назад
Hello, great tutorial, but can You try this for STM32G0B0CET6 ? I got only blank name/board/mem size and device type: "UNKNOWN" in stm32CubeProgrammer.
@bluewat
@bluewat 9 месяцев назад
I can only tell you to doublecheck the various steps
@pallavikadaam
@pallavikadaam 4 месяца назад
hello i 'm also facing same issue.
@chaos_technology
@chaos_technology 4 месяца назад
@@pallavikadaam If I remember correctly, there is a problem with memory organization. In my case, an additional section was created in RAM before the loader functions. Solution: check the RAM structure with a memory analyzer. Delete the extra section. It worked for me.
@apaczenko1993
@apaczenko1993 9 месяцев назад
Hello, great libray but I have some problems with creating external loader. I another project, libray works excellent (while testing communication with flash chip). But when I want create a external loader while debuging project the Flash_TestAvailability always return 0. I tried to set lower speed but without success (in another (test) project i was able to set max SPI speed and everythink works well. Regarding to debugging the loader project i found that HAL_SPI_Transmit(&FLASH_SPI_PORT , data, dataSize, HAL_MAX_DELAY) always return HAL status BUSY. Maybe someone knows why :)
@bluewat
@bluewat 9 месяцев назад
I'll take a look
@apaczenko1993
@apaczenko1993 9 месяцев назад
​@@bluewat my mistake, i forgot add last zero to adress, I was writing 0x9000000 instead 0x90000000, now everythink works excellent also touchgfx :)
@DianiAmine
@DianiAmine 7 месяцев назад
nice@@apaczenko1993Its working on IAR?
@electronic-ebox6403
@electronic-ebox6403 4 месяца назад
Hi my external loader is downloading only upto 128Kb file. in flash (w28q64). but can read full chip of size 0x800000 =8mb. could you please help?
@technosavy397
@technosavy397 4 месяца назад
Hi. I am also facing the same issue. External loader cant write more than 128kb data. Have you solved problem? Or anyone have solution?
@bluewat
@bluewat 4 месяца назад
I had a project having about 1MB loaded onto a flash without problems, I don't remember if sometimes I had something needing more than 1M. I checked that project right now: an F103@64MHz (a bluepill) with a w25q64 on spi1@2Mbps. If you like a help, you should provide at least some information: what's your system? How you say you can't write data over 128k? You mean you get an error? what's the error? ...
@bluewat
@bluewat 4 месяца назад
I guess you have an error READING/VERIFYING flash (via CubeProgrammer). If so your EL is ok, flash is (hopefully, if you haven't a mistake somewhere) correctly programmed, it is a limit of CubeProgrammer. Try to disable verify option (even on CubeIde), and see what happens. I'm close to publish a new video explaining (among other topics) even this case
@hashirama9997
@hashirama9997 10 месяцев назад
Great example! Thank you
@bluewat
@bluewat 10 месяцев назад
👋
Далее
The onchip EEPROM of STM32 L0 and L1 series
35:45
Flash Basics (Part 1)
21:07
Просмотров 62 тыс.
STM32 Guide #1: Your first STM32 dev board
12:12
Просмотров 206 тыс.
CAN Bus Explained - A Simple Intro [v2.0 | 2021] 🌟
14:44