 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 Cubamax. 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. 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 TATGFX 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 MaconX. I will start by launching TATGFX designer version 4.17 and TATGFX designer is a GUI builder that lets you easily build your graphics application. On the left hand side 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 Octospy 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 IUC file. I have my STM32 CubemX project open. I'll go to pin out and configuration tab and then to connectivity. And here we see we have two instances of Octospy peripherals. So the Octospy peripheral is used to interface to Octospy or serial flash memory. So if you look at the schematic of the STM32 H7B discovery board we see that the Octospy instance 1, so here Octospy 1 is used to interface to the Octospy flash memory. I go back to CubemX and select Octospy 1. Here in the mode we have all the modes supported by the Octospy peripheral. Single spy, dual spy, quad spy, quad spy, multiplexer and here we'll 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 and that's why we'll 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'll select port 1, port 1 clock. Same way for the chip select. If we go back to the schematic we see the chip select in Pg6. We go to Pg6 and here we see that Pg6 can be mapped to Octospy port 1 chip select. Go back to CubemX 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 and 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 the 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 we enable the datastrobe we see here in the schematic that datastrobe or DQS signal is used and the pin used for that is PC5. So we enable the datastrobe 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. I01 the schematic uses Pf9 while QBMX uses PC10 by default. We'll change it. Here we do search for Pf9 and here toggles change it to Octospy I1. For I02, I02 by default QBMX uses PE2. I'll change it to Pf7. Pf7 and Octospy I02. 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 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 Octospy 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 Octospy Part 1 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 storep 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 1 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 MicroNX, AP memory or MicroNX RAM. So here the memory type specifies the order of the data in double transfer rate 8 data bit mode. In MicroN mode the data is organized as D0 and then D1 while in MicroNX 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 MicroN mode. We can see in the MicroNX 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 then I see it's D0 D1. It's 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 Cubemax. The IS 25LX 256 is 32 megabytes flash memory. 32 megabytes is 32 megabytes is 2000 hexadecimal value and we see that bit bit 25 is set. So 2 power of 25 is 32 megabytes. So here in Cubemax 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 25LX 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 Cubemax and then I start my calculator. So I divide 30 nanoseconds by the clock period of the octaspire. We have the frequency here to the octaspire 133 MHz and we need to divide it by the clock rescader 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 IS 25LX 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 will select low. We keep the app 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 D 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.