• Where to start - AudioStream and the missing Software ISR

    Michele Perla08/10/2016 at 22:51 0 comments

    The Audio library relies on the AudioStream class, which is part of the Teensy 3.x core. This class takes care of the audio packets that an audio object may use.

    Whenever the audio packets used in an application have to be updated, an ISR is thrown. The Kinetis Ks have a nice feature, that is there's a Software Interrupt which can be thrown via software intervention - duh - instead of hardware intervention. This Software ISR does not exist in the Nested Interrupt Vector Controller (NVIC) of the SAMD21 family. The major issue is that the whole Audio Library relies on this ISR, because it is used to pass data beween Audio objects through the AudioConnection pipes that connect them.

    BUT there's a feature in the SAMD21, the Event System (EvSys) which allows us to trigger any interrupt by mean of a software event (as explained in section of the SAMD21 datasheet). If an interrupt is enabled, it can be triggered by setting one bit in one register of the EvSys channels (given that the EvSys and the selected channel are properly configured).

    The AudioStream class is the first priority of this port, because nothing in the Audio library will work without it. Therefore, first thing to do is to implement a simple API to use the EvSys, in order to port the AudioStream class to the SAMD21.

    I'll come back with details about the other issues I'll tackle along the way.