Early design review: MCU with Quad SPI and External Memory Interface. - Page 1
Forum section: electronics / general

author: obiwanjacobi
author_rank: Super Contributor
timestamp: January 30, 2017, 10:25:44 am
content: For myZ80 computer projectI am now researching how to make a Video circuit (GPU).The computer is to become a game console and the Video card/GPU is to offload the Z80 as much as possible. It will be more powerful than the Z80 itself. Here's a block diagram of what I had in mind.TheFTDI EVE2 chip is to take care of the grunt work and the MCU will need to supply the commands over (quad) SPI to drive it. Any graphic function that is not already in the EVE chip, I will code in the MCU. The plan is to start with Tiled-based games so moving graphic tiles around and having several (soft?) sprites will be the immediate goal.The extra memory will be used to store all the tiles and tile maps etc. - close to the EVE chip. The game program on the Z80 directly moves the tile files from disk to GPU at startup.The idea is to use an ARM MCU - because I want to learn ARM - to use as the brains of the GPU. I just need to find one that has (hardware) support for a quad SPI port AND an external memory interface. Higher speed is better, more on board memory is better, lower price is better.The extra Memory will probably be a couple of MBs of some cheap DRAM, as fast as possible. I have never worked with DRAM before, so that will be fun to learn too.As an alternative I have thought of replaceing the MCU for an FPGA (I have an Altera Cyclone II) and obviously that will solve the hardware interfacing problems, but I do not know if I can make all the graphic-functional aspects work (and fit)...disclaimer: I do not want to use vintage period correct video chips of the time when Z80 was all the rage. I want to build a video GPU that performs good and learn new stuff doing it.So can you help me find a suitable ARM chip?Other thoughts?

author: ale500
author_rank: Frequent Contributor
timestamp: January 31, 2017, 06:29:08 am
content: Depending on what you want regarding dept of color and resolution, it may be a good idea to use a FPGA. If you can fit your framebuffer in block memory, you save on complexity... if not... it may not be the easiest why of doing things.I'd ask what are your requirements ? not only resolution and dept, but play fields, sprites and the such., before you commit to a hw/sw solution.Edit: I re-read your comment and I think that a couple things are a bit mixed up:You want to learn ARM microcontrollers: choose a board with LCD & SDRAM like the discovery 746 480x272 TFT 24 bit color and like 8 MB SDRAM. It is like 50 €. There is also the Discovery 429 with the same SDRAM and a 320x240 TFT, for something like 30 €. Ready to go.DRAM ? you mean async DRAM ?... used and maybe NOS parts available... I'd go for SRAM 256kx16 or similar: easier, plentiful, fast.I rather decide on the requirements first than commit to a unsuitable platform.

author: obiwanjacobi
author_rank: Super Contributor
timestamp: January 31, 2017, 07:23:26 am
content: The EVE2 chip can do 800x600 with 24 color bits (3x8). That is plenty for the graphics I had in mind. I looked into building it from scratch with an FPGA, but I have very limited experience with FPGAs and thought that would be too much to handle at one time (I do know how to program C/C++ etc). I also just want to try out the EVE2 chip.I want the game to interface with this GPU at a logical level. So tiles are indexed/named and tile maps are uploaded to the GPU as well so it can auto display it. There will be functions for (setting up) scrolling and perhaps rotation. I want at least 3 layers of tiles for back-, mid- and foreground. I may want transparency, dependent on performance cost. I want enough sprites to make the games interesting. Dependent on the sprite-size and MCU performance I may need more/or less. I don't think the EVE2 chip really supports sprites so that would be the job of the MCU.I dont want a small LCD, I want VGA so I can connect to the TV and Monitors. I have a simple STM32F103 dev board I can experiment with to get started with ARM. I also already program on a Cypress PSoC5 - that is also ARM, but you hardly notice because of the good IDE.What type of DRAM to use, I don't know yet. Big, fast and cheap - and as wide as possible for better throughput - at least 16 bits - also depends on the width of the external memory interface. If that is 32 bits, I will do 32 bits (or put 2 16bits DRAM chips in parallel).So, I have thought about the requirements, but I find it hard to predict if the hardware will deliver. This is a hobby-project and the main goal is to learn new things. I don't mind failing or making mistakes, I will try again. I thought this design would be a good starting place and have some room for change as the experience progresses and teaches me different.That is why I figured I needed an ARM MCU with an external memory interface and a quad SPI port (EVE2 talks up to quad SPI)....

author: obiwanjacobi
author_rank: Super Contributor
timestamp: February 01, 2017, 12:55:09 pm
content: Does anybody know anARMMCU with anexternal memory interfaceand aquad SPIport?thanx.

author: Scrts
author_rank: Frequent Contributor
timestamp: February 01, 2017, 01:45:21 pm
content: Quote from: obiwanjacobi on February 01, 2017, 12:55:09 pmSTM32F4 ?

author: obiwanjacobi
author_rank: Super Contributor
timestamp: February 01, 2017, 02:37:14 pm
content: Quote from: Scrts on February 01, 2017, 01:45:21 pmThanx.The STM32F446 seems a likely candidate.However they keep harping on about the quad-SPI being used to interface memory devices, but that is not what I need it for... Will this quad SPI work as a generic interface?Quad SPI app note:http://www.st.com/content/ccc/resource/technical/document/application_note/group0/b0/7e/46/a8/5e/c1/48/01/DM00227538/files/DM00227538.pdf/jcr:content/translations/en.DM00227538.pdf

author: nctnico
author_rank: Super Contributor
timestamp: February 01, 2017, 03:12:18 pm
content: IIRC some of the higher end ARM7TDMI based controllers (LPC2000 series) from NXP have an external memory interface and 4 bit parallel SPI-ish interfaces (for use with SD cards).

author: hans
author_rank: Super Contributor
timestamp: February 01, 2017, 03:12:35 pm
content: I think you will have to put all the instruction phases, dummy cycles, etc. on non used if you want to do that. Then you can just bang bytes out like SPI, but now on 4 lines.But Quad SPI is useful if you can memory map it into MCU's memory architecture. I guess you want to use the FT81x series of chip using quad SPI.Paragraph 5 (page 40)tells you how the memory map looks like, and where the registers etc. of the FT81x chip map to.If you map the FT81x memory address range into the STM32F4's memory map (at some kind of offset) over quad SPI (using the correct instruction phases), reading/writing to the LCD registers becomes transparent like any other hardware peripheral. All the random access addressing should be handled by the hardware.You could also write software for it like Ft810WriteRegister(), Ft810WriteBitmap(), etc., and as long as it's software you can change it at any time.

author: daveshah
author_rank: Unknown
timestamp: February 01, 2017, 05:10:24 pm
content: If you're going for something like the STM32F4 (STM32F7 would be another option if you need even more power) you might be better off using the builtin TFT controller (which will also drive VGA with a suitable DAC) rather than the FTDI device.

author: jnz
author_rank: Frequent Contributor
timestamp: February 01, 2017, 11:55:34 pm
content: There are a lot of Quad SPI Cortex M micros.What I've always wondered though is if in the STM32 specifically if you could use hardware SPI combined with bitbanding to make hardware quad SPI in a module that didn't actually have it. Probably pointless though.

author: ajb
author_rank: Super Contributor
timestamp: February 02, 2017, 03:19:13 am
content: Quote from: daveshah on February 01, 2017, 05:10:24 pmAs long as you don't mind the signals being strewn randomly about all four sides of the package and hamstringing half of your other peripherals due to pin conflictsIt's almost like ST TRIED to make their pin muxing as obnoxious as possible.

author: obiwanjacobi
author_rank: Super Contributor
timestamp: February 02, 2017, 11:51:01 am
content: Quote from: hans on February 01, 2017, 03:12:35 pmThat sounds great and would be awesome if that would work, but how would I make sure that the correct protocol is sent over the wire(s)? (4.1.2 and further of the same document) - I have trouble finding the STM32 docs/datasheet for all this stuff...Quote from: daveshah on February 01, 2017, 05:10:24 pmYes, good point. However I have not found the details (docs) for that yet and I am wondering how much performance that will take out of the MCU and if there will be enough left for the higher level graphic functions I was planning to make...?Quote from: nctnico on February 01, 2017, 03:12:18 pmThanx, will take a look.

author: obiwanjacobi
author_rank: Super Contributor
timestamp: February 03, 2017, 01:43:44 pm
content: To let you know where I am...The NXP seem to be older and less fast.http://www.nxp.com/products/microcontrollers-and-processors/arm-processors/lpc-cortex-m-mcus/lpc2100-200-300-400:MC_71580This is a one-off project so a couple of bugs extra for the MCU is no problem.I am looking at the STM32F446 ZE(T=QFP)http://www.st.com/content/st_com/en/products/microcontrollers/stm32-32-bit-arm-cortex-mcus/stm32f4-series/stm32f446/stm32f446ze.htmlNow reading the reference and programming manuals to gather detailed info if my design will work.(External Memory Interface, Quad SPI and LCD interface)Thinking of buying (something like) this for experimentation:http://www.ebay.com/itm/NUCLEO-F446ZE-STM32-Nucleo-144-STM32F446ZE-Board-for-ST-Zio-and-morpho-/262409768682?hash=item3d18d74eea:g:1ZIAAOSwubRXIeeKAny suggestions? Shoot!

author: krho
author_rank: Regular Contributor
timestamp: February 03, 2017, 03:57:36 pm
content: Yeah. Buy from farnell. 18,5€

author: obiwanjacobi
author_rank: Super Contributor
timestamp: February 04, 2017, 07:55:04 am
content: Quote from: krho on February 03, 2017, 03:57:36 pmThanx! Didn't expect thatI found somecheap SDRAMbut it needs a clock of 133Mhz (lowest). If I read theReference Manual (at page 313)correctly the SDCLK is the main clock (HCLK) divided by 2 or 3. So with a main clock of max 180MHz, 90Mhz is the best I can get, correct?What type of SDRAM can I use then?

author: krho
author_rank: Regular Contributor
timestamp: February 04, 2017, 09:34:10 am
content: AFAIR something like that is on STM32F429I-DISC1 board. What I didn't check is if it has a QSPI.Find the above disco board info pdf and look at the schematic and BOM.

author: hans
author_rank: Super Contributor
timestamp: February 04, 2017, 11:52:51 am
content: I have the STM32F429 DISCO board, and that chip does not support quad SPI.It's only on the STM32F446 and the STM32F46x and STM32F47x series.Nevertheless, the IS42S16400J SDRAM chip is also used on the STM32F429 DISCO board. The datasheet says it operates at 80MHz.

author: obiwanjacobi
author_rank: Super Contributor
timestamp: February 04, 2017, 12:57:23 pm
content: Quote from: hans on February 04, 2017, 11:52:51 amThis is the datasheet I have found:http://www.issi.com/WW/pdf/42-45S16400J.pdfIt does not mention a lower clock rate then 133 MHz (that I could find - page 17)...You have a different datasheet?

author: nctnico
author_rank: Super Contributor
timestamp: February 04, 2017, 02:02:05 pm
content: There is no maximum clock cycletimespecified. 133MHz is the maximumfrequencyfor the part for certain operating conditions.

author: obiwanjacobi
author_rank: Super Contributor
timestamp: February 05, 2017, 10:42:39 am
content: Ok, so that would work then (obviously when others have used it too).The STM32F446 does not have the TFT port. It does have a HDMI-CEC function, but if I understand that correctly, that is for control only. So the FTDI EVE chip it is.I read some more on Quad SPI and it looks like the FT81x chip can indeedbe addressed as memory mapped IO(Chapt4 / Page16).The STM32F446 does seem to haveenough configuration optionsto make that work (Chapt12[.3.2]/ Page 323=>).As for the Video DACs I was planning on using theADV7125(KSTZ50), which I've seen being used in other designs. Looks pretty easy to interface and fit straight onto the outputs of the EVE chip. Not sure what the pitfalls are to look out for on this. Obviously the high frequency is something of a concern (no experience with that) and perhaps the analog power supply? Plenty of decoupling needed of course...So all I need is some level-shifters to interface between the +5V of the system and 3V3 this GPU (STM32F446) will be running at. Any recommendations?I have some(SN74)CBT16800C's...Looks like it's coming together nicely (unless you guys can point out some fatal flaws)...

author: obiwanjacobi
author_rank: Super Contributor
timestamp: February 05, 2017, 11:14:22 am
content: Little more detail...

author: krho
author_rank: Regular Contributor
timestamp: February 05, 2017, 11:45:31 am
content: If you need tft port do you still need QSPI then?If answer is yes, then STM32F469 or STM32F479 also has a TFT port. If not, then you can go lower than 446 to 429 (TFT+SDRAM).Finding the right chip with STM32CubeMX is easy

author: obiwanjacobi
author_rank: Super Contributor
timestamp: February 05, 2017, 12:05:35 pm
content: Quote from: krho on February 05, 2017, 11:45:31 amI don't think I need a TFT port. I want VGA to plug in monitors and TVs.

author: krho
author_rank: Regular Contributor
timestamp: February 05, 2017, 07:51:56 pm
content: Hm. No Idea gow godd this is but..https://olimex.wordpress.com/2012/06/12/low-cost-lcd-to-vga-adapter/

author: Scrts
author_rank: Frequent Contributor
timestamp: February 06, 2017, 02:47:52 am
content: Quote from: nctnico on February 04, 2017, 02:02:05 pmExactly, I've used SDRAM with 50MHz clock and it was perfectly fine.

author: obiwanjacobi
author_rank: Super Contributor
timestamp: February 06, 2017, 06:57:01 am
content: Quote from: krho on February 05, 2017, 07:51:56 pmSo you're suggesting I should choose a bigger MCU that has a TFT port and convert back to VGA...?Sounds suboptimal to me. Can you explain your reasoning?Quote from: Scrts on February 06, 2017, 02:47:52 amThanx for the confirmation.

author: obiwanjacobi
author_rank: Super Contributor
timestamp: February 09, 2017, 09:54:14 am
content: Just discovered that the STM32F446 has 5V tollerant IO. So I probably won't even need to level-shift explicitly between the system-interface and the MCU. Have not discovered how that works specifically, but then I just began reading the docs.I started on a schematic and had fun creating the 144 pin MCU in KiCad as a library part as well as the SDRAM part. I have used the schematic of the STM32F429 DISCO board as a guide on how to connect the SDRAM to the MCU.I initially thought I would require the part with the most pins I could find, but perhaps I can use the smaller VE part in the final design. We'll see.