New to ESP32. Which one should I buy for my specified needs?

RetroZvoc
Posts: 9
Joined: Tue Nov 27, 2018 1:21 am

New to ESP32. Which one should I buy for my specified needs?

Postby RetroZvoc » Tue Nov 27, 2018 2:17 am

Hello.
I've been programming AVR XMEGA and AVR MEGA microcontrollers, but I didn't like some things about them. I've always wanted to make my own alternative to a Sony Ericsson K510i/C510/2705 phone which would have things like a file manager, music player, paint program, programmable apps, etc.. This has been such a childhood dream that I even have drawings of that since 2010. Throughout my learning about computers, I've learned C/C++, AVR assembly, 6502 assembly for NES homebrew game development, Multimedia Fusion-like tools, Game Maker Language (GML), but I've really wanted to make my own full thing.

So now I found out about this ESP32 microcontroller that could help me with learning how to make new things. Unfortunately, my first experience with one has been when I bought one from eBay and it would heat up really fast. The datasheet said it shouldn't be so, but maybe this happened because it could be a clone. I would like to see where I can order a board with these capabilities:
- ESP32 should have 2 CPU cores with modifiable CPU microcode where I could insert things like matrix operations and logarithmic color mixing for 3D graphics rendering
- ESP32 should have internal 2MB of Embedded Flash. If I read correctly, there's one version which has this feature. I hope that these 2 megabytes are mounted directly onto the ESP32 CPU's address space for access via my program(s) without latency as with the serial flash so that my program doesn't have to load itself into RAM and so that I don't have to use that pesky PROGMEM and other nonsense that I had to lose my nerves and nights over in highschool when making my final project on AVR XMEGA.
- Huge emphasis on DMA channel number speed as well as 80MHz of SPI speed for a 320x240 TFT display for sending pictures at 60fps (I won't use a framebuffer, but scanline buffers to decrease memory usage and instead render graphics just like how retro consoles did it: GBA's nametable layers, NES's sprites, SNES's HDMA, 2D vector graphics from OAM memory as PS1 did with Spyro 2)
- There should be at least 4MB of external flash and at least 4MB of external RAM on board
- I would like to do memory management with caching things myself. I've read that things can be pushed out of the normal memory and into the external RAM, but my project needs to be truly real-time and I would like to gain full control over the memory management even if I have to learn about it rather than struggle for 6 months learning something only to find that a key feature which I assumed to be available doesn't exist (like putting a breakpoint into an AVR without JTAG, but via USART console shell).
- All pins need to be available for me to use and labeled so that I know which one is which
- SD card and headphones/microphone/headset jack need to be present (example: https://www.aliexpress.com/item/MP3-Bre ... 87637.html )
- USB type C connector with a LiPo battery and a charging circuit along with a USART interface with the ESP32 microcontroller. If there's an USB microcontroller that could help me use my board for USB Mass Storage, that could be awesome as it was with Sony Ericsson phones
- If a screen is available, it should be a 320x240 16-bit and 24-bit color TFT running at max 60FPS and with an adjustable manual refresh rate and 80MHz SPI transfer rate over DMA.

I'm sorry if this seems to be too broad, but I'm unable to find the correct components and I don't want to buy cheap clones, but the real thing at the price around $50-$100 (including shipping and taxes) to Croatia.

Thank you for your help.
RetroZvoc

WiFive
Posts: 3529
Joined: Tue Dec 01, 2015 7:35 am

Re: New to ESP32. Which one should I buy for my specified needs?

Postby WiFive » Tue Nov 27, 2018 2:35 am

Suggest you look at odroid go and m5stack

ESP_Sprite
Posts: 8921
Joined: Thu Nov 26, 2015 4:08 am

Re: New to ESP32. Which one should I buy for my specified needs?

Postby ESP_Sprite » Tue Nov 27, 2018 4:38 am

You may read up a bit more on the ESP32 itself first, as you seem to have some ideas about it that only have a tenuous connection to what we actually create in silicon:

- The ESP32 has an Xtensa controller, which has the option to define extra instructions. This happens at CPU design time, however; as soon as the controller is manufactured, the instructions are fixed. So unfortunately, no definable microcodes.
- The ESP32 has a version with 2MiB of flash in the same package, but it's a separate die that's still connected in the same fashion as an external flash chip would be.
- PROGMEM is not needed on the ESP32, not with internal or with external flash. Just declare something as 'const' and the compiler will make sure it won't be loaded into RAM.
- The ESP32 does support DMA'able SPI channels, which will work even without a full framebuffer. (The SPI master example in esp-idf uses this.) The ESP32 can run this at 80MHz, but I'm not sure if you can find a LCD controller that will be able to match that...

The thing that comes closest that is made by Espressif is the esp-wrover-kit, by the way, even if it does not check all your boxes. (Also, shameless personal plug because I made it, but it may be relevant: the PocketSprite also comes somewhat close to your idea of a gaming machine, is based around the ESP32 and has an open-source SDK.)

RetroZvoc
Posts: 9
Joined: Tue Nov 27, 2018 1:21 am

Re: New to ESP32. Which one should I buy for my specified needs?

Postby RetroZvoc » Tue Nov 27, 2018 5:17 am

WiFive wrote:Suggest you look at odroid go and m5stack
I've seen M5stack and it sounds promising. However, the equipment is very expensive and I'm not sure if it would work out.

Odroid looks very good and it is well done, but I'm concerned regarding legality. Odroid has an Android logo which I'm not sure if it may be used. I looked upon GitHub to see the code and it's a total mess. License documents (LICENSE.txt) are missing and there's an issue where in some folders there are many files with multiple license notices in headers saying that there needs to be a license.txt file containing that license, but that's impossible because there are multiple licenses. There are many occurences of LGPL being used without COPYING.txt being put in the folder. I think I even saw a ShareAlike license in a buttons code. This could be a seriously legal issue and I would like to see if this could be fixed in an easy way because I don't want to suddenly lose tons of rights and have tons of licenses terminated upon me. How should I report this issue to the library owners?

I have to admit that Odroid is a very well done microcontroller console project. It has ESP32 with the addons I've mentioned. It has 10 buttons (8 buttons are a minimum according to my standards). It has a 320x240 color display which surpasses my expectations of a retro console's display resolution of 256x240 (NES). It has some flaws however. There's no headphone jack and there's a danger that if my DMA code for my sound engine malfunctions, the speakers break from such a high volume! MakerBUINO solved this with a potentiometer and a headphone jack nearby. I hope that writing my own library/engine from scratch won't be a problem regarding the sound volume.

What has been your experience with this console?
ESP_Sprite wrote: You may read up a bit more on the ESP32 itself first, as you seem to have some ideas about it that only have a tenuous connection to what we actually create in silicon:

- The ESP32 has an Xtensa controller, which has the option to define extra instructions. This happens at CPU design time, however; as soon as the controller is manufactured, the instructions are fixed. So unfortunately, no definable microcodes.
- The ESP32 has a version with 2MiB of flash in the same package, but it's a separate die that's still connected in the same fashion as an external flash chip would be.
- PROGMEM is not needed on the ESP32, not with internal or with external flash. Just declare something as 'const' and the compiler will make sure it won't be loaded into RAM.
- The ESP32 does support DMA'able SPI channels, which will work even without a full framebuffer. (The SPI master example in esp-idf uses this.) The ESP32 can run this at 80MHz, but I'm not sure if you can find a LCD controller that will be able to match that...

The thing that comes closest that is made by Espressif is the esp-wrover-kit, by the way, even if it does not check all your boxes. (Also, shameless personal plug because I made it, but it may be relevant: the PocketSprite also comes somewhat close to your idea of a gaming machine, is based around the ESP32 and has an open-source SDK.)
I was watching videos about ESP32 game emulators and Bitluni's PAL TV 3D rendering and operating system semaphors/mutexes that are used to ensure data atomicity.

It's sad that there's no way to define my own opcodes. I was brainstorming about JIT compiling unrolled loops of color shading parabola equation calculations where each iteration is a single CPU instruction which would make 3D shading superfast. Same with color mixing, gradients, transparency, 3D bezier curve patch projection onto the 2D display so that the in-game characters don't look blocky, and other ideas.

Hold on. You said it won't be loaded into RAM. But how will the CPU be able to quickly load that data if it's inside of a SPI-access flash which creates a read/write delay? So there's no way to

Do you have a code example / tech demo containing a full-frame no-tearing 2D/3D game rendering example with this "scanline buffer"-ish approach as I call it?

I'm looking into the ILI9341 display's datasheet. What is its maximum speed when it's running on Odroid and an NES emulator? I hope it is able to quickly render the picture. A YouTuber said that there's tearing, but I'm not sure if it's because the screen refreshes on its own at a rate not exactly 60fps but 59.99fps or is it because it simply cannot keep up. According to my calculations, a 40MHz DMA should be able to send a 320px*200px*24bit*25fps picture with 96% of bandwidth. Odroid has both the SD card and the display connected to the same SPI bus which is a big issue since I would love to stream OGG audio and sound effects from the SD card during gameplay as well as buffering 3D city data in the background like how it's done in Driver 1/2 for PS1.

Since Odroid seems to not have what it takes to do my job, could you help me find a good ESP32-WROVER board seller? I hope that those have at least 4MB of external Flash and at least 4MB of external RAM and that they have separate SPI busses for SD card and display.

I think I saw your game console before. Unfortunately, that's way too small for my big hands and for my eyes + I wear glasses, lol. :ugeek: It's a great job there!

I'm not sure if ESP32 is what I'm looking for. I mean, I had a wish to use ATXMEGA128A1U's undocumented, but promised 24-bit external bus interface without any latch chips for the external SRAM and for an external display which I was hoping to have its own memory that could be directly accessable byte by byte. It's really sad... I wouldn't consider buying a Raspberry Pi because it's like shooting a fly with a bazooka which is seriously cringy just like when people make "their own OS" which is just a silly MS Paint bitmap compilation with Visual Basic (which is good for a beginner at programming or a very young prodigy, but not something that should be showing up to a serious programmer like me). I was considering that in the worst case scenario of ESP32 not workign for me I would instead get a nice cheap FPGA with a good dual-core high frequency CPU inside which is well-supported so that I could implement my graphics engine and other things inside of it just like how Gameduino (not Gamebuino) has it done.

ESP_Sprite
Posts: 8921
Joined: Thu Nov 26, 2015 4:08 am

Re: New to ESP32. Which one should I buy for my specified needs?

Postby ESP_Sprite » Tue Nov 27, 2018 7:32 am

Configurable microinstructions is pretty uncommon for the main processor nowadays; I think that stopped happening around the time of the Xerox Alto. It seems to be something that's relegated to coprocessors nowadays. I agree, it would be fun to have.

The way the flash is accessed is via a cache. That indeed means there's going to be a performance hit the first time you access something, but after that it's single-cycle, 240MHz full speed fast. It may not be what you're used to if you have used microcontrollers with integrated flash before, but for general-purpose usage, it works remarkably well.

I don't know of an actual scanline rendering engine, but the toy example I refered to earlier is here: https://github.com/espressif/esp-idf/tr ... aster/main . Note it's not 60FPS and does tear, but this is a limit of the ILI9341 that's on the default devboard: it only allows a limited SPI clock speed, and while the LCD controller has an output to indicate it's going to re-start drawing to screen, most LCDs do not have this line on an accessible pad.

In your case, I'd indeed almost advise to go with the external FPGA option. It may even be easiest to just slave a FPGA to an ESP32: do the graphics voodoo in the FPGA, use the ESP32 to bootstrap it and do the more down-to-earth game logic. If any, if you decide on something to make, I hope you publish it somewhere; I'm always interested in people doing awesome things with interesting hardware.

User avatar
loboris
Posts: 514
Joined: Wed Dec 21, 2016 7:40 pm

Re: New to ESP32. Which one should I buy for my specified needs?

Postby loboris » Tue Nov 27, 2018 9:12 am

@RetroZvoc
Maybe some of those RISC-V boards could be better choice for your needs.
K210, dual-core RISC-V 64bit chip, used on them is only couple of months old and you may have some difficulties in setting the development environment, but it is very promissing.
I've ordered couple of boards, and I'm planning to test the combination of MAIX Bit board/MAIX-I module and ESP32 connected over SPI interface.

Who is online

Users browsing this forum: Google [Bot], zelenecul and 117 guests