Also, I intend to have it as an embedded hardware development assisting and educational tool. Having the pin layout setting interactive makes it easier for advanced hobbyists, and is good for teaching the basics for beginners.
If someone gets a development board, the first thing he/she looks at is the pinout image. For most boards, the problem can be solved by providing a single image.
But even that image can't contain those hundreds of pages of documentation for the cores, and every detail about the board. Anybody can easily bump into a problem which needs thorough searching.
The learning curve for this hobby is very good at the beginning, when someone buys a new board, plugs in the USB, tries out the famous "blink", then other examples, some tutorials.
Then when trying to some something original, there comes the part when this gets bumpy and after a while maybe even frustrating.
If somebody survives this, and becomes a real hardware specialist, then the learning curve will normalize and continue in a smooth way.
The problem is obviously the bumpy part. And that is because as a beginner nobody will read all the documentation, just look at what the Internet gives. My proposal is a way to transform the documentation to an interactive form with on-demand immediate information.
A brief look at complexity the challenge has:
Let's take a look at an advanced example:
There are 3 SPI interfaces with up to 3 CS pins in ESP32 from Espressif, each can be used as:
- standard: "MISO+MOSI+SCK+SS/CS"
- quad-mode: with 2 additional pins (mainly used for external flash and RAM)
- 3-wire: where MISO and MOSI share the same pin.
There is also a possibility to have SS and SCK on the same pin.
(The virtual Arduino core for it makes things easier, and for beginners it looks like there is only 1 standard SPI, and no info about the 3 HW CS pins. This is why pinout images for ESP32-based boards can look simple)
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, and could cause confusing problems if a project gets more complex. The goal is to avoid limitations the more we can for any kind of board, 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.
Even one single digital I/O pin can cause confusions, if it is connected to something on the board. For that the schematic is needed. With MCU Pin Setup it would be a click on the pin, and the information would appear on the screen as a warning.
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 interactiveness can allow an extra feature: automatic initializing 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), then it can be altered, and another code generated. The application code would not be affected at all.
- If during the project design the pin layout needs to be modified, then just load it to the tool, modify it, generate the new code. Application code not affected.
- If a project is being finalized, the application code is ready, and a custom board is developed, then the generated layer can be fully customized.
Going one step further: If a project is real-time OS based, then this tool could be paired with an UML modeling software, having the application code also generated.
This way the whole development procedure could become visual and interactive, helping embedded real-time OS based education.