rtp-MIDI / Apple-MIDI question…

Status
Not open for further replies.

blake

Member
Hello!

My Arduino has finally run out of horsepower and a good friend suggested I turn my attention to the Teensy platform. Before I dive in, I wanted to make sure I was on the right path.

My project aims to incorporate both Bonjour-style/Zeroconf networking as well as receiving MIDI over the local network via rtp-MIDI, (aka Apple-MIDI).

Does anyone have any experience using this Arduino library on a Teensy, or if not, what are the probabilities of it working?

https://github.com/lathoub/Arduino-AppleMidi-Library

Thank you!
 
This is the first I've heard of this AppleMIDI library.

Looks like it ought to work. The EthernetShield_NoteOnOffEverySec example compiles for Teensy 3.2. Since this uses the Ethernet library for communication, it really ought to "just work".
 
do I need to care about this warnings?

If using Teensy 3.x, you can probably just ignore these warnings.

If using Teensy LC, these will be a serious problem. Cortex-M0+ requires 16 and 32 bit memory access to be properly aligned to 2 and 4 byte memory boundaries. When this code casts an arbitrary byte pointer to those types, unless other code aligns the memory properly, there's a 50-50 chance a 16 bit access with hard fault (crash your program), and a 3 in 4 chance a 32 bit access will fault.

The Cortex-M4 processor used on all Teensy 3.x can handle unaligned memory access. It's slower since it has to access the memory twice, but that's still better than 4 accesses on an 8 bit processor for 32 bits.
 
To get rid of these warnings, the code can be changed to use void pointers instead of unsigned char. That still doesn't solve the unaligned access trouble, but it will quiet the compiler warnings.

To actually deal with memory alignment, the variables need to be allocated as 32 bit types (as OctoWS2811 does) or an align attribute can be used. This issue recently came up with FastLED and Mark solved the problem that way. Here's the code:

https://github.com/FastLED/FastLED/commit/06a5abcf1fa65115adb42a79e112a34e6c8ff5a7
 
Status
Not open for further replies.
Back
Top