Hi Anyone,
I've been struggling with an intermittent issue and hoping someone might have some suggestions or seen something like this before.
The setup:
DSPBIOS: v5.33.03
DSPLINK: v1.64
DM648 BIOSPSP: v1.10.03
EDMA3_LLD: v1.05.00
XDC: v3.10.03
CG6X: v6.1.08
GPP is an Atom running Linux with PCI to a DM647 (not DM648)
A custom FPGA is used as the audio source/sink via 4 (2 channel TDM) McASP serialisers.
The FGPA is the McASP master of all serialiser using the same CLK and SYNC lines.
For a total of 8 In, 8 Out audio channels @ 96kHz.
The DSP Software:
Based on the examples from the BIOSPSP, the only main changes are with psp_audio file as we only use the McASP and don't need codec control.
Also the McASP is configure to use 4 serialisers in and 4 serialisers out.
The rest of the code is "above" the DSPBIOS layer.
Pseudo code/outline to follow.
During main()
dsp, edma3 and dsplink initialised.
McASP buffers allocated from IRAM (L2 heap) each 64(samples) * 8(Channels) * 4(UInt32).
I double buffer the In and Out stream.
I create two high priority SWI's, one for McASP Input buffer processing and another SWI for McASP Output buffer processing.
The McASP driver is SIO_create()'d twice once for SIO_OUTPUT and again of SIO_INPUT, using the SIO_ISSUERECLAIM model.
Both use callbacks that SWI_post() the appropriate SWI on completion of a buffer.
After main returns
A NOTIFY() signal from the GPP is used to start the audio processing.
I SIO_issue() all the buffers to their required drivers.
SWI Pseudo code
Both INPUT and OUTPUT SWI's are very similar
SIO_reclaim() a buffer from associated driver
if (encoder/decoder enabled)
{
CPU copy audio data into/from DDR2 audio channel buffers.
signal data to be processed.
}
SIO_issue() the buffer back to the driver.
Lower priority SWI's and TSK's handle encoding/decoding the McASP audio data(PCM) and sending/receiving this data via DSPLink (MSGQ).
The issue:
At an intermittent point during the infinite issue/reclaim SWI cycle the input McASP driver's callback will get called immediately after an SIO_issue() indicating that the buffer is complete.
The SWI's SIO_reclaim() does NOT return an error, so the buffer is processed as valid and then SIO_issue()'d again which is then immediately return, via the callback... repeat...
The output McASP driver is still ticking along as expected.
During my investigation I changed SIO_reclaim() to SIO_reclaimx() and found the pfstatus parameter was being set to -1 when this issue occurs.
With this status information I can now end the loop.
What I can't figure out is why pfstatus starts always return -1?
Obviously the driver has entered an error state but I can't figure out what has caused it.
There are a couple of scenarios that can help produce this issue.
- If I change the order of SIO_create()'s calls, I create the SIO_INPUT McASP driver before the SIO_OUTPUT driver, then this issue will usually (45%) happen with 1 minute of start up. With no encoder/decoders enabled.
I originally put this issue down to an initialisation issue, but now seems related. - When using a third party encoder library, which requires IRAM buffers, this issue will usually occur within 10 mins.
If I reduce the number of serialisers to just 1 (2 channels) when initialising the McASP layer, this issue does not happen.
From my investigations I feel it is related to a EDMA/L2 RAM timing issue and I'm in the process of using all L2 as cache for some testing, but need some form of "FASTRAM" for the library to work. (L1 RAM) Is what I am currently trying to configure.
Any thoughts or suggestions would be greatly appreciated.
Steven.