SD card logging on Teensy 4.0 in Simulink Arduino support package (It shares an SPI bus with a sensor)?
Afficher commentaires plus anciens
I am using the Simulink Arduino support package with a Teensy 4.0 to build custom flight controller firmware. So far, I have been able to communicate successfully with my sensors over SPI:
- ICM20948
- BMP388
and I2C:
- TF-Luna Lidar Range Finder
and I can also receive iBUS data from my transmitter. However, I am having trouble finding a clean way to do SD card logging directly through Simulink on the Teensy 4.0. As many may know, the Teensy 4.0 does not have an inbuilt SD card, so it is sharing the bus with the ICM20948. This is a custom PCB design, and all components have been validated with an arduino based flight controller.
My main questions are:
- Is SD card logging natively supported for the Teensy 4.0 through the Simulink Arduino support package?
- If so, how do I configure the chip select pin for the SD card?
- Does the support package properly handle a shared SPI bus, where the SD card and other SPI peripherals are on the same bus but use different chip select lines?
This shared bus point is important for my setup, since I already have SPI sensors connected and working. I am unsure whether the support package supports this kind of multi-device SPI configuration correctly, or whether it assumes a simpler one-device-per-bus usage.
At the moment, most of the possible workarounds seem to involve wrapping custom C/C++ code, but I would prefer to stay inside the Simulink workflow if possible. I am looking for either:
- a native Simulink block-based way to log data to SD on Teensy 4.0
- guidance on shared SPI bus support in this setup
- or confirmation that custom code wrapping is currently required
If anyone has gotten SD logging working on a Teensy 4.0 in Simulink, especially with other SPI devices active on the same bus, I would appreciate details on the block setup, hardware configuration, and any required custom code.
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Modeling dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!