 Hello and welcome to this presentation. My name is Bedardine and in this video we will learn how to set up a different OctoSpy flash memory and that gfx template. In this first part we'll see how to set up the OctoSpy peripheral in STM32 cuba max. If we look at page 20 of the STM32 h7b discovery board user manual we see that it has a 512 megabit OctoSpy north flash memory and this video will see what changes need to be done to use a different memory from a different vendor and a different flash size in the touchfx application. For example we'll use the IS-25 north flash memory from ISSI the IS-25 family comes in two sub-families the IS-25LX family operating at 3 volts and up to 133 MHz the IS-25WX family operating at 1.8 volts and up to 200 MHz. The two families come in 128 megabit and 256 megabit flash size. We'll use the IS-25LX-256 because its operating voltage is compatible with the STM32 h7b discovery board. Besides this memory comes in BGA package and it's pin-to-pin compatible with the one from Macon X. I will start by launching touchGFX designer version 4.17 and touchGFX designer is a GUI builder that lets you easily build your graphics application. On the left hand sign select examples and select the board setup. In this video I'll use STM32 h7b3 discovery kit and then click select. For the example example I will go with animated image example given name to my application STM32 h7b underscore octos pi IS-25LX-256 and then click create. I have my example ready I'll generate the code then browse to the files click on files here on the left hand side go up by one level here and then double click on STM32 h7b3 I will see file. I have my STM32 QBMX project open I'll go to pin out and configuration tab and then to connectivity and here we see we have two instances of octos pi peripherals so the octos pi peripheral is used to interface to octospi or serial flash memory. So if you look at the schematic of the STM32 h7b discovery board we see that the octospi instance 1 so here octospi 1 is used to interface to the octospi flash memory. I go back to QBMX and select octospi 1. Here in the mode we have all the modes supported by the octospi peripheral single spy dual spy quad spy quad spy multiplexer and here we'll use octospi mode because we have eight data lines if we go to the schematic we see that we have eight data lines from IU0 to IU7 and that's why we'll use octospi mode. In the clock we have either the possibility to connect the clock signal to port 1 clock or port 2 clock. If we go to the schematic we see that the clock pin is PB2 and then we go to the device datasheet table 9 we see that PB2 pin is or can be mapped to octospi port 1 or P1 clock. So we'll select port 1, port 1 clock. Same way for the chip select if we go back to schematic we see the chip select is Pg6 we go to Pg6 and here we see that Pg6 can be mapped to octospi port 1 chip select and go back to QBMX and select port 1 chip select and here we see in the GPIO settings tab under configuration we see the default pins enabled for the octospi and we see here for the chip select PB6 is used by default and PF10 is used by default for the clock. So here we need to match the schematic so the schematic uses Pg6 for the chip select and so we need to type in Pg6 and change the default configuration to from Pb6 to Pg6 so Pb6 is again is correct configuration is just it doesn't match the schematic. So use Pg6 for the chip select and for the clock same way for the clock we see for the clock PF10 is used by default go back to schematic I see that the clock used in the schematics Pb2 so here I'll change it to Pb2 Pb2 octospi port 1 clock. I go back to the mode and we enable the data store we see here in the schematic that data store or DQS signal is used and the pin used for that is PC5 so we enable the data store for port 1 and the default configuration is PC5 and it matches the schematic. Next we'll do the data lines port 1 same way and here we need to make sure it matches the schematic so we have the data lines expand this so for the I0C in the schematic for the I0 is Pd11 while the QBMX uses PC9 so we'll change it to Pd11 to octospi I0 there same way for I1 I1 the schematic uses PF9 while QBMX uses PC10 by default we'll change it here with the search for PF9 and here toggles change it to octospi I1 for IU2 IU2 by default QBMX uses PE2 I'll change it to PF7 PF7 and octospi IU2. One more data line is the IU3 PF6 so by default IU3 is mapped to PF6 which matches the schematic then we'll enable the data from 7 to 4 the MSB of the data same way we need to make sure that the configuration matches the schematic here we check IU4 IU4 by default it's PD4 while the schematic uses PC1 we'll change it to PC1 octospi part 1 IU4 next IU5 IU5 by default uses PD5 this is the QBMX default configuration while the schematic uses PH3 we'll change it to PH3 octospi part 1 IU5 IU6 PG9 by default and this matches the schematic IU7 PG40 and this doesn't match the schematic the schematic uses PD7 so we go here and search field and we type in PD7 and we change it to octospi part 1 IU7 okay now one more thing we need to go to system core GPIO and then the octospi tab here and we need to enable the internal pull up for the data stop signal so which is PC5 so here in the GPIO pull up pull down configuration we need to enable the internal pull up for the chip select we already have an external pull up so now need to enable the internal pull up for the chip select signal next I go back to octospi one and then to parameter settings here we'll set up the octospi peripheral so we'll leave the 5 4 threshold to 1 I'll keep the dual quad mode disabled because we have one single octospi memory the memory type we have either micron macronax AP memory or macronax RAM so here the memory type specifies the order of the data in double transfer rate 8 data bit mode in my micron mode the data is organized as D0 and then D1 while in macronax it is D1 and D0 if we go to the device data sheet we see that the data comes out as D0 then D1 so the IS memory is compatible with micro mode we can see in the macronax data sheet that the data comes out as D1 then D0 then D3 and D2 so I'll go back to IS 25 data sheet and then I see it's D0 D1 so compatible with micron type next we specify the device size which is the size of the external flash memory in bytes and it is calculated as 2 power of n where n is the device size parameter here in cuba max the IS 25 lx 256 is 32 megabytes flash memory 32 megabytes is 32 megabytes is two zero zero zero zero zero hexadecimal value and we see that bit bit 25 is set so two power of 25 is 32 megabytes so here in cuba max I said the device size to 25 next the chip select high time is the minimum number of clock cycles where the chip select must remain high between commands the IS 25 lx 256 specifies 30 nanoseconds here if we go to page 88 we see here that tshsl2 is 30 nanoseconds so we need to divide 30 nanoseconds by the clock period of the octaspi I go back to cuba max and then start my calculator so I divide 30 nanoseconds by the clock period of the octaspi the clock period of the octaspi is so we have the frequency here to the octaspi 133 megabytes and we need to divide it by the clock prescader which is three so the clock period is three divided by 133 megabytes so we divide 30 nanoseconds by three and then we multiply by 133 megabytes so here we have 1.33 we round up to to the next value which is 2 so here we set the chip select high time to 2 we'll keep the free running clock disabled the clock mode the clock mode indicates the level taken by the clock between commands when the chip select is high in page 47 page 47 of the IS 25 lx 256 data sheet we see that the memory supports mode 0 or low level and mode 3 which is high level so our flash memory supports both low and high will select low we keep the app size not supported the clock prescader 23 meaning the clock on the bus is 133 as we saw earlier the octaspi is 133 megahertz divided by the prescader three here so which gives us octaspi clock of 44.3 megahertz we'll keep the sample shifting to none and will enable delay hold quarter cycle which means we will add a quarter cycle delay on the outputs in DTR communication to match the whole timing this is recommended when using double transfer rate or DTR node I will keep the other parameters to their default value now I will generate the code my code is successfully generated I'll click on open project I have my STM32Q by the launcher here I need to give a new workspace and click on launch thank you for joining me in this video and we hope that you enjoyed learning how to set up the octaspi peripheral in STM32Q MX in the second part of this video we'll see how to initialize the octaspi flash memory