This project tries to tackle is the disadvantage of the advantage of having many possibilities.
Also, I intend to have it as an embedded hardware development educational tool. Having the pin layout setting interactive makes it easier for advanced hobbyists, and is good for teaching the basics for starters.
If someone gets a development board, the first thing he/she looks at is the pin layout. For most boards, for example Arduino, the problem can be solved by providing a single image.
But for example looking into the official documentation the ESP32 provided by Espressif, it becomes obvious that a single image showing all is impossible to provide.
A brief look at complexity the challenge has:
There are 3 SPI interfaces with up to 3 CS pins in ESP32, each can be used as:
- standard: "MISO+MOSI+SCK+SS/CS"
- quad-mode: with 2 additional pins (mainly used for external flash and ROM)
- 3-wire: where MISO and MOSI share the same pin.
There is also a possibility to have SS and SCK on the same pin.
All SPI inputs/outputs can be set to any pin you like.
However if you use other pins than the "primary" ones assigned to them, you can go up to only 40 MHz. So a setting also depends here on the pin layout.
If somebody would like to just start a project, and he/she doesn't use the virtual Arduino core provided, then:
- Needs to read through the documentation carefully.
- Grab a pen and a paper, figure out the pin layout.
- Write the code implementing it.
- Bump into errors and continue from step 2 or even step 1.
Of course someone can just use the virtual Arduino core which takes care of the pin setup, but it may have limitations to it. The goal is to avoid limitations, let the user decide the setup, but make is as easy as possible.
The challenge described here is explained mainly through the ESP32, but can be applied to other boards using MCUs with adjustable pin layout. For example the SPI1 on Maple Mini (STM32 core) can be set to 2 different positions.
The vision is a WYSIWYG tool which primarily serves as a visual guide for the pin layout setup.
Anyone looking at it could immediately see the board itself with all functional information for its pins.
Exactly the same as a single image provided for most basic boards.
The difference between this and single pin layout image is that this is fully interactive.
- Quick menu for board changing. With boards using the same core, active settings could be quickly transferred and showed how they look on different boards.
- Clicking on pin names show detailed information about that particular pin, including board-specific information (e.g.: on-board pull-up resistor, LED).
- Peripherals are listed and can be enabled/disabled, if applicable for the active board. Some may not be available for some boards (disabled only), others may be connected to an on-board device (enabled only).
- Different modes for interfaces can be selected, filtering selectable pins.
- Peripherals also have a detailed information which is showed on-demand. Board-specific information also included.
- Not only pins are selectable, but peripheral-specific options, like clock source, speed, etc. Dependencies are needed for some, like if using external clock source, then the specific source must be enabled.
- Saving and loading the whole pin layout and setup.
- Automatic code generation based on the setup. Code flavors may be selected.
- Easy tool extension/correction: All MCU and board specific information stored in human-readable JSON format.
This tool of course could be really powerful with the automatic code generation.
A layer can be created between the core libraries and application code.
It could have several advantages:
- Speeding up a project start-up. Click together the setup, then generate a code, and everything will be automatically set.
- Focusing on the application code, and having the visual hardware tool is good for education of beginners.
- Creating cross-board projects less painful: If a setup is not good for a specific board (e.g.: a pin is not routed out),...