Teensy 3.1 Serial3 issue
cchaz003 opened this issue · 2 comments
Hello, first thank you so much for this port! Its made chibios on the Teensy so much easier to use than trying to get it running nativly. I have just run into an issue however. Whenever I enable/init Serial3 with Serial3.begin(baud) a lot of weird things start to happen. It never locks up the system, or at least the teensy doesnt detect any faults but I think it somehow interferes with the other serial ports.
On the project that I'm working on, I currently use the usb serial to send data to a computer, Serial1 to talk to a Teensy 2 (not running chibios), and Serial2 for an LCD. I wanted to add a dedicated debug line between the teensy3 and teensy2 (for various printed messages) so I decided to use the last of the available serial ports however even when I just add Serial3.begin(115200) or any other baud rate, suddenly code that worked stops working. It seems to me that when I put that line in, synchronous messages stop working for some reason. Mailbox messages still seem to work but when a synchronous message is sent the program seems to hang. This may be caused by my own buggy code of course in my message checking routine however since it hasn't ever failed like this and since just adding the Serial3.begin() line causes these problems I feel like it might not be my code. I am still fairly new to RTOSes and have been doing a lot of head scratching on this one.
I know that this isnt a lot of information to go on, but if you have any insight, it would be much appreciated.
~Charlie
I only ported the ChibiOS/RT kernel and the kernel does not know about any teensy3 hardware devices. The port only uses the systick_isr. ChibiOS/RT replaces the weak default routine with this:
void systick_isr() {
systick_millis_count++;
if (sysTickEnabled) SysTickVector(); <<-----------------Added line
}
Serial3 may cause ChibiOS to fails since is very different from the other two serial ports.
I find comments like this for Serial3 (UART2):
// UART0 and UART1 are clocked by F_CPU, UART2 is clocked by F_BUS
So when you enable Serial3, different hardware features are used.
I tried to avoid any conflict between ChibiOS/RT and devices controlled by the Teensy core software but it could be happening. Bare meatal programs like the Teensy3 drivers often use hardware features that interfere or hang an RTOS.
Thank you for the prompt reply. I had a feeling Serial3 was slightly different from the other 2 after scouring the teensy forums and release notes. Well thanks for at least clearing it up a bit more for me. I suppose I will just have to live without the dedicated debug line for now.
thanks,
~Charlie