Quantcast
Channel: Infineon Forums
Viewing all articles
Browse latest Browse all 9892

[SPI DMA] Missing first byte

$
0
0
Dear Infineon,

I'm currently working on a XMC4700-F100F2048 configured in DAVE with an SPI_MASTER app and a DIGITAL_IO to manage the SPI_CS.

SPI_MASTER app is configured in DMA mode both in transmit and in receive and runs at 1Mb/s, Full-duplex.

My firmware has both a bootloader and an application, developed in two different DAVE projects. SPI works correctly in bootloader, but when the
application starts the first SPI transaction doesn't send the first byte.

To emulate this behavior i developed a test project with the SPI configured as follows:

Attachment 3684

Attachment 3685

Here it is the main.c code:

Code:

#include <DAVE.h>                //Declarations from DAVE Code Generation (includes SFR declaration)


static uint8_t buffer[3] = { 0x01, 0x02, 0x03 };

void SPI_Send( uint8_t *buffer, uint8_t length )
{
        DIGITAL_IO_SetOutputLow( &SPI_SS );
        SPI_MASTER_Transmit( &SPI_MASTER, buffer, 3 );
        while( SPI_MASTER_IsTxBusy( &SPI_MASTER ) );
        while( SPI_MASTER_GetFlagStatus(&SPI_MASTER, (uint32_t)XMC_SPI_CH_STATUS_FLAG_MSLS) != 0U );
        DIGITAL_IO_SetOutputHigh( &SPI_SS );
}

int main(void)
{
        DAVE_Init();

        SPI_Send( buffer, 3 );

        SPI_MASTER_Init( &SPI_MASTER );

        SPI_Send( buffer, 3 );

        while(1U);
}

What it is missing?

Thanks in advance for your kindness,

Andrea
?????

Viewing all articles
Browse latest Browse all 9892

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>