The project on the Github: https://github.com/nvitya/nvcm
The NVCM is an open source, object based, true multi-vendor C++ software framework for ARM Cortex-M microcontrollers. It allows to create easily MCU vendor-independent or multi-MCU software, while the code stays small and very effective.
Those microcontrollers, that share the same drivers belong to the same NVCM microcontroller family.
Family | Sub-Family |
---|---|
ATSAM | 3X, 4S, E70/S70/V70 |
ATSAM_V2 | D51/E5x, C2x, D10 |
IMXRT | IMXRT1020 |
KINETIS | K20, KL03, KV30 |
LPC | LPC43xx |
LPC_V2 | LPC8xx |
LPC_V3 | LPC546xx |
STM32 | F0, L0, F1, F3, F4, F7, H7 |
XMC | XMC1xxx, XMC4xxx |
The NVCM defines a simple, unified object interface for the MCU integrated peripherals. For the implemenatation no MCU vendor libraries are used, the drivers are directly manipulating the peripheral registers.
Driver | ATSAM | STM32 | LPC | XMC | ATSAM_V2 | LPC_V2 | LPC_V3 | IMXRT | KINETIS |
---|---|---|---|---|---|---|---|---|---|
CPU Speed | OK | OK | OK | OK | OK | Partial | OK | OK | Partial |
Pin Cfg. + GPIO | OK | OK | OK | OK | OK | OK | OK | OK | OK |
UART | OK | OK | OK | OK | OK | OK | OK | OK | OK |
DMA | OK | OK | OK | - | OK | - | OK | - | - |
SPI Master | OK | OK | OK | OK | OK | - | OK | - | - |
I2C Master | OK | OK | - | OK | OK | - | OK | - | - |
I2C Slave | OK | OK | - | - | OK | - | - | - | - |
Ext. IRQ. | OK | OK | - | - | OK | - | - | - | - |
Internal Flash | OK | OK | - | - | OK | - | - | - | - |
ADC | OK | OK | OK | - | - | - | - | - | - |
Simple PWM | - | OK | - | - | - | - | - | - | - |
QSPI | OK | OK | OK | - | OK | - | OK | - | - |
Ethernet | OK | OK | - | - | - | - | - | - | - |
CAN | OK | OK | - | - | OK | - | - | - | - |
USB Device | - | exp. | - | - | - | - | - | - | - |
SD Card | exp. | - | - | - | - | - | - | - | - |
Some Popular Development Boards, that are included into the NVCM source tree:
Family | Board Id. | Name |
---|---|---|
ATSAM | BOARD_ARDUINO_DUE | Arduino DUE (ATSAM3X8E) |
ATSAM | BOARD_XPLAINED_SAME70 | SAM E70 Xplained Evaluation Kit |
LPC | BOARD_XPRESSO_LPC4337 | LPCXpresso4337 |
LPC | BOARD_XPLORER_LPC4330 | LPC4330-Xplorer |
LPC_V3 | BOARD_XPRESSO_LPC54608 | LPCXpresso54608 |
STM32 | BOARD_MIN_F103 | STM32F103C8 Minimum Development Board (breadboard friendly) |
STM32 | BOARD_DISCOVERY_F746 | Discovery kit with STM32F746NG |
STM32 | BOARD_NUCLEO_F746 | NUCLEO-F746ZG |
STM32 | BOARD_NUCLEO_F446 | NUCLEO-F446RE |
STM32 | BOARD_DISCOVERY_F072 | Discovery kit with STM32F072RB MCU |
STM32 | BOARD_DEV_STM32F407VG | STM32F407VG Minimal Board |
STM32 | BOARD_DEV_STM32F407ZE | STM32F407ZE Development Board |
XMC | BOARD_BOOT_XMC1200 | XMC1200 Boot Kit |
This list does not cover all built-in boards, and it is simple to define a board for a special project.
Family | Board Id. | Name |
---|---|---|
ATSAM | BOARD_MIBO64_ATSAM4S | MIBO64-ATSAM4S |
ATSAM_V2 | BOARD_MIBO64_ATSAME5x | MIBO64-ATSAME5x |
STM32 | BOARD_MIBO20_STM32xxxx | MIBO20-STM32 |
STM32 | BOARD_MIBO48_STM32xxxx | MIBO48-STM32 |
STM32 | BOARD_MIBO64_STM32xxxx | MIBO64-STM32 |
This NVCM core project contains some useful external module drivers as well:
- TFT LCD displays: SPI, Parallel
- I2C OLED displays (SSD1306)
- Some monochrome LCD displays
- SPI, QSPI flash memories, I2C EEPROM
- Led and Key module and some other serial 7 segment displays
- Simple stepper motor
There are several multi-board examples which reside in a separate repository: [https://github.com/nvitya/nvcmtests]. Download/clone this repository and follow the instructions there.
GPIO Setup on STM32F103 Minimum Development Board:
TGpioPin led1pin(PORTNUM_C, 13, false);
void setup_board()
{
led1pin.Setup(PINCFG_OUTPUT | PINCFG_GPIO_INIT_1);
}
GPIO Setup on Arduino DUE (ATSAM3X8E):
TGpioPin led1pin(1, 27, false); // D13
void setup_board()
{
led1pin.Setup(PINCFG_OUTPUT | PINCFG_GPIO_INIT_1);
}
GPIO Setup on LPC4330-XPlorer (independent Pin and GPIO numbering):
TGpioPin led1pin(1, 12, true); // D2
TGpioPin led2pin(1, 11, true); // D3
void setup_board()
{
hwpinctrl.PinSetup(2, 12, PINCFG_OUTPUT | PINCFG_AF_0); // D2: GPIO_1_12, pad B9
hwpinctrl.PinSetup(2, 11, PINCFG_OUTPUT | PINCFG_AF_0); // D3: GPIO_1_11, pad A9
led1pin.Setup(PINCFG_OUTPUT | PINCFG_GPIO_INIT_1);
led2pin.Setup(PINCFG_OUTPUT | PINCFG_GPIO_INIT_1);
}
GPIO Usage:
++hbcounter;
led1pin.SetTo(hbcounter >> 0);
led1pin.Set0(); // fast inline code on most MCUs
led1pin.Set1();
UART Setup (STM32F103) and Usage:
hwpinctrl.PinSetup(PORTNUM_A, 9, PINCFG_OUTPUT | PINCFG_AF_0); // USART1_TX
hwpinctrl.PinSetup(PORTNUM_A, 10, PINCFG_INPUT | PINCFG_AF_0); // USART1_RX
THwUart conuart;
conuart.Init(1); // USART1, use default settings: 115200, 8, 1, n
conuart.printf("Hello World %i !\r\n", 1);