Evaluating ChibiOS/HAL
Posted: Thu Jun 23, 2022 3:40 pm
Hi - ChibiOS/HAL and other Chibi tools may be a really good solution for a new app I'm working on and I have a few questions before I dive in. Here's some background. I'm porting a medium size (12000 lines or so) embedded program written in C# for a SAM9 processor to C/C++ and a STM32H7A3 controller. The program is architected as a pretty classic Gang Of Four state machine with asynchronous FIFO queues between the devices and the state machine. Currently, there are 8 different UART devices (GPS receiver, Iridium modem, oceanographic instruments, etc. ) and 3 I2C devices (voltage/current/energy monitors, ADCs, etc.) with more in the future, so lots of I/O. Coming from the C# world, I'm a big fan of an object oriented architecture. I have the core part of my program running on a ST Micro Nucleo H7A3ZIQ development board using VisualGDB and the ST Micro HAL library.
It was quite a struggle to get the STM HAL library working in an OO architecture and at first glance, the ChibiOS/HAL seems like a much better architecture for an OO program. Here are a few new user type questions.
Q1) It would be nice to have a UART class with all the code required to communicate over a specific UART (drivers, IRQs, callback, etc.) that I can instantiate or inherit or something like that in each of my device classes. Is that a reasonable approach using ChibiOS/HAL? The same approach would apply to an I2C class, an SPI class and so on.
Q2) if a UART class isn't the way ChibiOS/HAL is designed to be used, what is the preferred approach? I've read the docs for the UART HAL driver and it may be that just a few lines of code and a callback function are required to use a UART. So no class is required, I just put those few lines of code in my device class?
Q3) I've gone through a couple of demos using ChibiStudio but haven't been able to download them to my H7A3 Nucleo board. What do I have to do to port an existing demo to work on my H7A3 Nucleo?
Q4) I use DMA where ever possible and the character match functionality on the H7A3 and in your UART driver seems like a great approach. Is there a UART demo using the CM functionality.
My goal here is to write a simple first program that talks to a GPS receiver over a UART using the CM functionality on my H7A3 Nucleo board. If I can get that working without too much effort, you'll have a new user.
Thanks in advance - Gene
It was quite a struggle to get the STM HAL library working in an OO architecture and at first glance, the ChibiOS/HAL seems like a much better architecture for an OO program. Here are a few new user type questions.
Q1) It would be nice to have a UART class with all the code required to communicate over a specific UART (drivers, IRQs, callback, etc.) that I can instantiate or inherit or something like that in each of my device classes. Is that a reasonable approach using ChibiOS/HAL? The same approach would apply to an I2C class, an SPI class and so on.
Q2) if a UART class isn't the way ChibiOS/HAL is designed to be used, what is the preferred approach? I've read the docs for the UART HAL driver and it may be that just a few lines of code and a callback function are required to use a UART. So no class is required, I just put those few lines of code in my device class?
Q3) I've gone through a couple of demos using ChibiStudio but haven't been able to download them to my H7A3 Nucleo board. What do I have to do to port an existing demo to work on my H7A3 Nucleo?
Q4) I use DMA where ever possible and the character match functionality on the H7A3 and in your UART driver seems like a great approach. Is there a UART demo using the CM functionality.
My goal here is to write a simple first program that talks to a GPS receiver over a UART using the CM functionality on my H7A3 Nucleo board. If I can get that working without too much effort, you'll have a new user.
Thanks in advance - Gene