 Hello and welcome to this presentation. My name is Bedardine and in this video we'll learn how to set up a different OctoSpy flash memory and that GFX template. And this first part we'll see how to set up the OctoSpy peripheral in STM32 Cubamax. If we look at page 20 of the STM32H7B discovery board user manual, we see that it has a 512 megabit OctoSpy NOR flash memory. In this video we'll 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 NOR 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 STM32H7B discovery board. Besides this memory comes in BGA package and it's pin-to-pin compatible with the one from MaconX. I will start by launching the TouchGFX designer version 4.17. The TouchGFX designer is a GUI builder that lets you easily build your graphics application. On the left hand side I'll select examples and select a board setup. In this video I'll use STM32H7B3 discovery kit and then click select. For the example, I will go with animated image example. Give a name to my application STM32H7B-OIS25LX256 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 STM32H7B3IUC file. I have my STM32QBMX project open. I'll go to pin out and configuration tab and then to connectivity. Here we see we have two instances of Octospy peripherals. The Octospy peripheral is used to interface to Octospy or serial flash memory. If you look at the schematic of the STM32H7B discovery board, we see that the Octospy instance 1, so here Octospy1 is used to interface to the Octospy flash memory. I go back to QBMX and select Octospy1. Here in the mode we have all the modes supported by the Octospy peripheral. Single spy, dual spy, quad spy, quad spy, multiplexer. Here we use Octospy 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. That's why we use Octospy 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 Octospy port 1 or P1 clock. So we select port 1, port 1 clock. Same way for the chip select. If we go back to the schematic we see the chip select is Pg6. We go to Pg6 and here we see that Pg6 can be mapped to Octospy port 1 chip select. Go back to QBMX and select port 1 chip select. And here we see in the GPU settings tab under configuration we see the default pins enabled for the Octospy. 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. So we need to type in Pg6 and change the default configuration from PB6 to Pg6. So PB6 again is correct configuration. It just doesn't match the schematic. So we 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 schematic is PB2. So here I'll change it to PB2, PB2 Octospy port 1 clock. I go back to the mode and enable the data store we see here in the schematic. The 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. I'll expand this. So for the I0C in the schematic for the I0 is PD11 while QBMX uses PC9. So we'll change it to PD11 to Octospy I0. Same way for I1. I1 the schematic uses PF9 while QBMX uses PC10 by default. We'll change it. Here we do a search for PF9. And here toggles change it to Octospy I1. For IU2, IU2 by default QBMX uses PE2. We'll change it to PF7. PF7 and Octospy 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 Octospy 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 Octospy 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 Octospy IU7. Okay, now one more thing. We need to go to System Core, GPIO and then the Octospy tab here. We need to enable the internal pull-up for the data store up signal. So it's 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 we need to enable the internal pull-up for the chip select signal. Next I go back to Octospy I and then to parameter settings. Here we'll set up the Octospy peripheral. So we'll leave the 5-4 threshold to 1. I'll keep the dual quad mode disabled because we have one single Octospy memory. The memory type, we have either MicroNex AP memory or MicroNex RAM. So here the memory type specifies the order of the data in double transfer rate 8-data bit mode. In MicroNex mode the data is organized as D0 and then D1 while in MicroNex 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 MicroNex mode. We can see in the MicroNex data sheet that the data comes out as D1 then D0 then D3 and D2. So I go back to IS 25 data sheet and I see it's D0 D1. It's compatible with MicroNex 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 QMX. The IS 25 LX 256 is 32 megabytes flash memory. 32 megabytes is 2 0 0 0 0 0 hexadecimal value. And we see that bit bit 25 is set. So 2 power of 25 is 32 megabytes. So here in QMX I set 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 octaspire. I go back to QMX and then I start my calculator. So I divide 30 nanoseconds by the clock period of the octaspire. The clock period of the octaspire is... So we have the frequency here to the octaspire 133 MHz. And we need to divide it by the clock prescader which is 3. So the clock period is 3 divided by 133 MHz. So we divide 30 nanoseconds by 3 and then we multiply by 133 MHz. So here we have 1.33. We round up 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 of the IS25LX 256 datasheet 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. We'll select low. We'll keep the RAP size not supported the clock prescalar 23 meaning the clock on the bus is 133. As we saw earlier the octaspire is 133 MHz divided by the prescalar 3 here. So which gives us octaspire clock of 44.3 MHz. We'll keep the sample shifting to none and we'll 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 mode. 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 octaspire peripheral in STM32Q Mx. In the second part of this video we'll see how to initialize the octaspire flash memory.