-
-
Notifications
You must be signed in to change notification settings - Fork 284
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CurieI2S library #156
CurieI2S library #156
Conversation
- Minimal functional version
-Use interrupts to fill FIFO buffer from TX buffer
-CurieI2S using interrupts
-add basic examples using callback functions/interrupts -add callback function to fill tx buffer
In your I2S_RxCallback.ino example, might be a good idea to check if count is greater than 255, to prevent a possible buffer overflow. Even if the specific timing of this example code doesn't ever overflow the buffer, as an example published for general consumption by makers in the Arduino world, you can expect it to be used together with other example code that may alter the interrupt to main program timing. |
Good catch, Paul. I forgot to Run the PR through Klocwork. It flagged possible buffer overflow on lines 137 and 324. |
-prevent buffer overflow in I2S_RxCallback example -calculate delay for any sample rate
#endif | ||
|
||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May need to consider a timing window here. Consider a byte came in, after fifoDataLength was set with the h/w register earlier on. The FIFO would not be emptied here. With the "Almost Full" interrupt disabled and the "Empty" interrupt enabled, there may no more interrupt from here on. Would that be a real case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually think that it should be fine as long as we enter the ISR quickly enough.
The filling of the buffer is much faster than the transmission rate supported by the I2S.
The only real issue I see is if the user callback routine inside the ISR takes too long.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May be you leave the "Almost Full" interrupt enabled since the flag is going to be cleared. If the FIFO got filled up because the call back was taking its merry time, the AFull interrupt would not be missed.
@calvinatintel Went over the Almost Full interrupt with Dino. Looks good. Please merge. |
Used non fast-forward merge since there are multiple commits |
-interrupt based i2s library