XMC4500 SPI Issue - Any clues?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
lock attach
Attachments are accessible only for community members.
Not applicable
Currently working to overcome a hardware issue on a PCB. Effectively looking to use the SPI001 App to handle SPI comms to an external DAC but have a GP Output pin acting as an additional Slave Select line which will actually connect to the external DAC. For information I'm using the XMC4500 (144 Pin) Hex Development kit and using the debugger/a TEK MSO2042 scope to debug.

Successfully managed to configure the SPI001 App however I am having issues with a GP DigOut to act as a Slave Select. I have attached a very simple example project which exhibits the bug which hopefully details and exhibits the issue I'm seeing.

The code attached is simply writing some data to the SPI bus, whilst this data is being written I have set P0.0 low. Upon completion of the data being transmitted it is set back high. As shown in the attached scope trace P0.0 (Ch4 - Green) is clearly only staying low for a short duration prior to any data being written to the SPI bus. Below is the function I am periodically calling to write data to the SPI bus.

void SPIWrite()
{
uint16_t Data;

P0_0_reset();

for(Data = 0; Data < 10; Data++)
{
SPI001_WriteData(&SPI001_Handle0,&Data,SPI001_STANDARD_HPC_OUTPUTMODE );
}
P0_0_set();
}


I have attempted using different GPIO pins on the device which repeat the same results. I have commented out the SPI001_WriteData call, this resolves my issue so suspect that somewhere within the DaveApp/generated code the output is being reset.

One interesting thing I have found is that stepping through the code line by line in the debugger does not show the fault. But free running the code in the debugger/running code without the debugger exhibits the fault.

Has anyone experienced similar issues? Any guidance/tips/ideas would be really appreciated! Have included some further detail below. Apologies if lacking detail.

Cheers

Dave

*********************************************************************************************
This has been achieved using the below project:



DaveVersion - 3.1.10 (Installer Build 2014-05-23)
SPI001 App Version - 1.0.24

The below scope trace details the reality of what is happening with thecode:



Ch1 - Yellow SCK P0.11
CH2 Blue MOSI P0.5
Ch3 Pink ChipSelectA P0.6
Ch4 Green GP DigOut P0.0
0 Likes
1 Reply
Not applicable
Hi davidkelly,

The reason why the GP output only toggle for a short while is because the function SPI001_WriteData only place the data into the transmit FIFO.
So when the CPU is out from the function SPI001_WriteData, is only mean the data has been put into the FIFO.
Basically, the transmission of the data is still on-going even when CPU is out from the function SPI001_WriteData.

What you need to do is check the MSLS signal. This signal will tell you whether the frame is finished transmitting.
0 Likes