SoundDMA randomly crashes on the Pi1
Jon Abbott (1421) 2651 posts |
I’ve been seeing random SoundDMA crashes and tracked it down to Sound0HAL using R14 whilst in IRQ32 mode. It looks like this issue has been there since Sound0HAL was originally created. Various lines of the 8bit to 16bit conversion code, such as line 3394 reference R14 whilst in IRQ mode and run the risk of R14 becoming corrupt if an IRQ occurs – which is what I’m seeing. Can the code be modified to use a different register, or use the original Sound0 method:
EDIT: It looks like IRQ’s should be off around the code, as line 3334 is disabling them before calling level 1. Perhaps line 3361 should ensure IRQ are off on the return before restoring R14?
|
Clive Semmens (2335) 3276 posts |
This stuff used to be my bread and butter, but I’m so rusty it’d use my entire stock of wet-and-dry to get back up to speed. I hope someone else is on the ball! 8~) |
Jeffrey Lee (213) 6048 posts |
Yeah, that sounds reasonable. Really it’s a bug in the level 1 code if it’s returning with IRQs enabled (although I haven’t checked what the PRMs say). But since it’s only one extra instruction there’s no harm in building some protection into the OS. Looking at the IOMD version of SoundDMA, it looks like it assumes that the level 1 code (and anything else) will be preserving the IRQ state, but it doesn’t do anything critical with R14 and so it won’t suffer a catastrophic failure if one of the routines returns with IRQs enabled. |
Jeffrey Lee (213) 6048 posts |
FYI – This should be fixed as of a week or two ago (SoundDMA HAL 1.84, and SoundDMA AC97 (i.e. Iyonix version) 1.69) |
Chris Evans (457) 1614 posts |
Jon: did it error or just fall silent? |
Jon Abbott (1421) 2651 posts |
It randomly crashed the machine as Sound0HAL now makes use of R14. I’ve not heard of it going silent before. One thing to try in that scenario is RMReInit all the relevant sound stack Modules, to see if it’s software or hardware related. IIRC, the order is:
|
Rick Murray (539) 13851 posts |
I have reported before about DigitalCD going silent when writing a full display to my OLED. Not bothered to look at why, beyond “disables interrupts for too long”. |