Using Teensy for a project with intensive Hardware usage and cross-triggering

LeonF

Member
Hi folks!

I'm an electrical engineering student from Germany, and me and a friend of mine are working on an open-source EMG-based upper limb prosthesis, which is also part of my master thesis.

We are currently looking for a microcontroller to be used as the central data processing unit (DPU) and we would love to use the Teensy 4.0/4.1!
The main advantage here is that the end users don't have to solder the BGA chip themselves, and it's relatively easy for them to program the firmware via USB.

The DPU will communicate with different sensor and actuator boards with hard real-time requirements, and will probably use machine learning to determine hand movements from EMG data. Therefore, the communication should run as completely as possible in hardware, using eDMA transfers that are triggered via (presumably) the PIT. Only switching between different boards should be handled via interrupts.

1701695588768.png


For this, I will have to (and want to) work primarily at register level - though initialization as with the MCUXpresso config tool would be very convenient.
At the same time, however, there are features in Teensyduino that I would very much like to use. Such as SD card libraries or (during development) the USB stack. I also find the synchronization of the RTC with the computer when uploading the firmware very useful!
-> Is there an intermediate way here? (When using Teensyduino it would for example be important to know which peripherals are used by default, I think I saw something like a "Peripheral Resource Overview" in the Beta Thread for the Teensy 4.0)

If not:
What restrictions are there for MCUXpresso projects when they run on the Teensy?
-> Does something have to be considered regarding the fuses? (I'm not very familiar with them yet)
-> Can a hex file created by MCUXpresso be flashed with the Teensy loader?
--> Is there even a CLI to integrate this into the build process?
-> Is it possible to use the RTC synchronization without Teensyduino?
-> Does the bootloader chip communicate with the RT1060 firmware for verification?

Debugging
Since debugging is probably mandatory for us, I currently see two ways: using the debug PCB from SpenceV1, or using the RT1060 EVK both only during development. For end users we would either use the Teensy or the MMOD.
-> Have any of you been at this point and can weigh up the pros and cons?
--> Currently I have access to several ST-Links (V2+3), RP Debugger (SWD only) and ESP-PROG - are any of them usable for the RT1060?


I know that was a lot of questions, but I would really appreciate some help.
Greetings!
Leon
 
I would suggest using Teensyduino and the Arduino IDE so that all the libraries become available to you.
Use VisualMicro and VisualStudio if you don't like the look and feel of the Arduino IDE.
 
Thank you for the fast answer!
One major concern I'm having with using the Arduino libs is that I don't know what peripherals they are using and/or configuring. Is there a sortof overview which libraries use which peripherals and which peripherals are used/configured by default?

PlatformIO also is named as a platform, are there any Problems about it?
(We need the IDE to run on Ubuntu and would rather not have to use the Arduino IDE)
 
Effectively you will be using the Teensyduino libs if you are using a Teensy.

A lot of people use PlatformIO with Teensy but it is NOT a PJRC supported platform.
Paul does a lot to help those people using PlatformIO with their problems but it is on an adhoc basis.

Arduino has recently updated their IDE to version 2.x. Apparently this is MUCH better to use than the 1.x version.
Personally I use Visual Micro/Visual Studio but as far as I know that is not available on Linux.
(Visual Micro sits on top of Arduino 1.x or 2.x so has maximum compatibility)

Is there a sortof overview which libraries use which peripherals and which peripherals are used/configured by default?
I think you have this the wrong way round (or it could be a language thing...sorry) it should be what peripheral uses which library.
Difficult to say, there are so many peripherals, and it's not unknown for a particular peripheral to be supported by many different libraries.

Better to list the peripherals you might be considering and then ask if there is likely to be any problem finding a suitable library for it.
Of course you could write your own library for a peripheral not covered by existing libraries.
By the way there is very little need to resort to using MCU registers to configure things unless your needs are not covered by existing Teensyduino libraries.
There are a number of libraries covering interrupts and timing.
 
Here is a list of the Libraries in Teensyduino:
Obviously you are not limited to these libraries, many more general libraries can be used.
Code:
AccelStepper
Adafruit_NeoPixel
Adafruit_nRF8001
Adafruit_STMPE610
Adafruit_VS1053
ADC
AltSoftSerial
Artnet
Audio
Bounce
Bounce2
CapacitiveSensor
CryptoAccel
DmxSimple
DogLcd
DS1307RTC
EasyTransfer
EasyTransferI2C
EEPROM
Encoder
Entropy
Ethernet
FastCRC
FastLED
FlexCAN
FlexCAN_T4
FlexIO_t4
FlexiTimer2
FNET
FreqCount
FreqMeasure
FreqMeasureMulti
FrequencyTimer2
i2c_t3
ILI9341_t3
ILI9488_t3
IRremote
Keypad
ks0108
LedControl
LedDisplay
LiquidCrystal
LiquidCrystalFast
LittleFS
LowPower
Metro
MFRC522
MIDI
MsTimer2
NativeEthernet
NXPMotionSense
OctoWS2811
OneWire
OSC
Ping
PS2Keyboard
PulsePosition
PWMServo
QuadEncoder
RA8875
RadioHead
ResponsiveAnalogRead
SD
SdFat
SerialFlash
Servo
ShiftPWM
Snooze
SoftPWM
SoftwareSerial
SPI
SPIFlash
ssd1351
ST7735_t3
Talkie
TeensyThreads
TFT_ILI9163C
Time
TimeAlarms
TimerOne
TimerThree
TinyGPS
Tlc5940
TouchScreen
USBHost_t36
UTFT
VirtualWire
Wire
WS2812Serial
x10
XBee
XPT2046_Touchscreen
 
Ah, yeah - maybe there is a misunderstanding here. I am referring to peripherals as parts of the MCU that are external to the m7 core, like for example the lpspi, eDMA or PIT.

I assume that for our case it is simpler to directly interact with the peripherals rather than using libraries provided by teensyduino, as we need to exactly know what each part of the hardware is doing at which time. This is true for at least all things regarding the communication/data flow mentioned in the OP.

On the other hand there are some libraries provided by teensyduino that we would like to use, like for example the USB-Stack, the SD-Card stuff and the RTC interfacing. But to use those it would be important to know which peripherals and interrupts the allocate.
It would be great if someone could point me towards a thread ore something that is covering this more low-level stuff - if there is such a thing:)

Thank you for your time so far and I hope it getting clearer what I am asking for?
 
One major concern I'm having with using the Arduino libs is that I don't know what peripherals they are using and/or configuring. Is there a sortof overview which libraries use which peripherals and which peripherals are used/configured by default?

No, there isn't any such comprehensive library hardware usage documentation. While some libraries are fairly simple and use SPI, Wire or Arduino GPIO functions to do their hardware access (most of Adafruit's libraries for various chips do this), some libraries are much more complicated and which hardware they use can vary. For example, SD / SdFat can use either SPI or SDIO to access a SD card. Audio has the ability to access several peripherals for audio input and output, so which hardware it uses depends which of its many classes your program instantiates.

However, inside pwm.c is a list of known usages of the various Teensy 4.x timers.
 
Last edited:
Back
Top