greiman / chrt Goto Github PK
View Code? Open in Web Editor NEWChibiOS/RT for Arduino AVR, SAMD, Due, Teensy 3.x, Teensy 4.0.
ChibiOS/RT for Arduino AVR, SAMD, Due, Teensy 3.x, Teensy 4.0.
Hello, Great work on this library! Just curious, is there any CAN support built in? I haven't been able to find any? Do we need to add that functionality in? Again thank you for your hard work!
I sometimes hit a hard fault when printing a double using the Serial.print( double a, int digit). At first, I thought it was related to the absence of a heap support but could not find any evidence of heap use. It's very hard to debug hard faults on the teensy due to the absence of a debugger.
The problem is that I am not even sure that this print is the cause of the problem but I am not sure how to debug that.
Any tips on how to debug that?
I am afraid I will have to revert back to a big loop design just to make sure nothing breaks in a month or two of uptime. It would be unfortunate as this small RTOS was so promising.
Hi I am Martín I am studying mechatronics and for one of my projects I need to know if there is compatibility with the Arduino ChibiOS and the ICUDriver, because I am trying to integrate the Ultrasonic Sensor (HC-SR04) with ChibiOS under this Arduino platform. An also I want to know if you have heard of other options to implement this kind of sensors that need the input capture unit.
I would appreciate any help or advice in this matter.
Grettings
Martín
On 2-14-2021 ChibiOS 20.3.3 “Dragonea” has been released. Could you please upgrade your library to use the latest ChibiOS version?
If you've got your hands full at the moment, any instructions how to do it would be useful. Maybe just ChibiOS sources should be replaced and that's all?
I can confirm that the latest versions are broken for me, tested on linux.... ( same symptoms as noted in forums)..
git clone code from here and use any of the examples, such as 'chBlinkPrint'
https://github.com/greiman/ChRt
and arduino-1.8.16
with teensyloader 1.55 from https://www.pjrc.com/teensy/teensy_linux64.tar.gz
However this combo works with the same ChRt example/s:
arduino-1.8.12 - https://downloads.arduino.cc/arduino...linux64.tar.xz
teensy loader 1.51 - https://www.pjrc.com/teensy/td_151/T...nstall.linux64
also posted this info in pjrc forums: https://forum.pjrc.com/threads/62076-Teensyloader-1-52-onwards-breaks-ChibiOS-on-Teensy-4
Dear ChRt team,
I am a newbie to ChibiOS and microcontroller programming. I have got a question regarding ChibiOS's main thread on an Arduino mega. I am using the ChibiOS version with Tag 1.3.0 as of https://github.com/greiman/ChRt/releases/tag/1.3.0 and I am using a NextionDisplay (https://nextion.tech/datasheets/nx4832t035/) connected via serial port to the Ardunio mega using the NextionLibrary (https://github.com/itead/ITEADLIB_Arduino_Nextion). To build everything I use platform.io.
Now I wonder where I am being wrong: The NextionDisplay is controlled by the Arduino over a serial port and signals the Arduino upon any touch events triggered on the NextionDisplay over the serial port. When polling the NextionDisplay touch events in a dedicated ChibiOS thread, no signals coming from the NextionDisplay are caught by the code in the thread, though when I poll for NextionDisplay touch events in the loop()
function I get the touch signals correctly while the other threads still being processed. As of my understanding, after having initialized all threads, ChibiOS's main thread ends up in the loop()
function similar to Arduino's super-loop (snippet from ChRt.cpp
):
void chBegin(void (*mainThread)()) {
...
// ChibiOS/RT initialization
chSysInit();
// Call continuation of main thread.
if (mainFcn) {mainFcn();}
// loop() becomes main thread.
while (true) {loop();}
}
For my use case this is a feasible approach, though I would like to know if it is good practice to place legacy serial communication processing (as of the NextionDisplay library) in the main thread (loop()
) or are there configuration means to use a dedicated thread when doing such communication (what have I missed)?
Below a snippet on how I created the thread, enabling line 13 and commenting out line 27 does not work, though the other way round enabling line 27 and disabling line 13 works (I get the touch events):
#include "NextionChibiOS.h"
#include <Arduino.h>
#include ...
#include <ChRt.h>
#define THREAD_MEMORY 256
THD_WORKING_AREA(displayArea, THREAD_MEMORY);
static THD_FUNCTION( displayFunction, arg ) {
while( true ) {
nexLoop(touchListeners); // NextionDisplay query touch events does not(!) function here
chThdSleepMilliseconds(100);
}
}
void startThreads() {
ch_thread *displayThread = chThdCreateStatic(displayArea, sizeof(displayArea), NORMALPRIO, displayFunction, NULL);
}
void setup() {
chBegin(startThreads);
}
void loop() {
nexLoop(touchListeners); // NextionDisplay query touch events does function here
chThdSleepMilliseconds(100);
}
I wonder which are the differences between the main thread and dedicateltly created threads regarding the thread memory or handling I/O or the like which makes it possible to run the NextionDisplay's nexLoop()
function correctly in the ChibiOS's main thread loop()
whereas there are constraints making it to fail to read from the serial port in a dedicated thread (as of ... chThdCreateStatic(displayArea, sizeof(displayArea), NORMALPRIO, displayFunction, NULL); ...
)?
Maybe you have can help me and give me a hint?
Thank you beforehand & best regards,
Siegfried
In st_lld_teensy4.cpp
the function setVectors()
is defined, which overwrites the fault handler vectors to custom functions defined somewhere else. These functions merely blink the builtin LED with a code corresponding to the type of fault.
While this may be useful, it prevents the CrashReport class, introduced in TeensyDuino 1.54, from working properly and reporting faults. See https://www.pjrc.com/teensyduino-1-54-released/ at "Fault Recovery & CrashReport".
I think it would be useful to keep that functionality for boards that feature the iMXRT chip, like Teensy 4.0, 4.1 and MicroMod.
Right now I merely commented out these four lines in setVectors()
_VectorsRam[3] = HardFault_Handler;
_VectorsRam[4] = BusFault_Handler;
_VectorsRam[5] = UsageFault_Handler;
_VectorsRam[6] = MemManage_Handler;
and that restored the CrashReport functionality.
I'll leave it up to you to decide whether this is something that you want to support in your codebase
Hey Greiman
Im working on a BLDC controller hardware project and would like to utilize the eminence power of the T4 for that purpose.
The overall purpose is naturally to empower the emerging EV community with a open EV framework for 12-72v systems on a standard CAN BUS. The BLDC controller will just be the muscle in this regard. Another node will take care of blinkers, horn, low beam, high beam, beam me up Scotty.
The question goes something like this:
Will you make a VESC port for the T4, and could you clean the windshield while your at it?
With your insights into ChRt you are the one to evaluate if it can be done and how much work vs the benefits involved.
//Morphius
In Arduino world, a .c file is ignored. Removing ChRt.c from src, ChBlink builds and run in Arduino IDE.
Import ChBlink in Atmel Studio works only if the (not usefull ?) ChRt.c is removed before import (because Atmel sutdio does handle both .c and .c++ files).
Regards.
Hi there!
First I want to thank you for this, it looks amazing and I'm really happy you decided to still work on this port of ChibiOS just for Arduino.
I've used vanilla ChibiOS but for simple things/project, it's a bit of an overkill. With ChRt I can get the best of both Arduino and ChibiOS.
I've been running all the examples on the Mega2560, changing a few things to see if everything breaks and for the moment I haven't found any bug.
On question I have though is about the chUnusedThreadStack()
. I've tried putting a stack of zero but in the Blink example but I still get everything to work as intended. Is that normal?
Hello,
I tried a quick and dirty mod to get things up with Teensy 4.0 but I didn't succeed so far.
Would it be difficult to support also Teensy 4.0 (which has its RAM splitted in two zones)?
Would it need adapations of ChRt-master\src\teensy3 files only?
Best regards
Good day Greiman,
Awesome job on this port. Not that I am a fan of using the heap in hard real time applications but do you foresee enabling it. I noticed it was disabled in the config_arm.h (CH_CFG_USE_HEAP). Simply setting that to true and trying to create an object on the heap simply does a hard fault.
Some libraries tend to use the arduino String and it fails silently. I have been converting those to C strings but...
Hello,
I came across your repo while investigating ChibiOS. I note that tickless mode is not supported for the SAMD architecture. My question is, is there any particular limitation(s) of the SAMD that prevents implementation of tickless mode? Or, is it simply that no one has taken the time to develop tickless timer functions for the SAMD? Other than the timer, is there anything else required to support tickless for SAMD?
Hi,
what is the license of ChRt ?
Is it possible tu use it for a commercial product ?
Thanks for your answer.
Philippe
Any plan to add support for Teensy LC?
Hi, would it be possible to add support for STM32F1 devices like Maple Mini clones?
Thank you so much for adding that support for SdFat!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.