Due Arduino, SPI communication, DMA, MASTER Slave, more SPI channels,

Hi,

Description:

1 pcs DUE as Master, 1 pcs DUE as SLAVE, communication via DMA and SPI channel SPI0_NPCS0 (SS10) on both DUEs.

The slave is the measuring MCU and sends 18x uint16_t values (e.g. 18 values from the ADC) to the Master. Master sends 18x uint16_t values (for example commands). The master initiates the communication. Only SPI0_NPCS0 channel (SS10) is active -> set REG_SPI0_MR= ...| ( SPI_MR_PS & 0) Fixed Peripheral Select is set.

This connection works and the communication does not show errors in the Master and in the Slave.

Can anyone advise how to move the function Fcia_DMA_TX_RX_VyslaniePrijemDat_MASTER(); to IRQ so that this function is activated outside the main loop?

In the attachment there are files for Master and Slave - maybe it will help someone.

But in addition to the communication between Master and Slave, I want to use the free SPI channels SPI0_NPCS1(SS4) and SPI0_NPCS2(SS52) of the Master to control 2 pieces of DAC MCP4922.

Here's the problem.

I set REG_SPI0_MR= ...| ( SPI_MR_PS ->Peripheral Select) for communication with multiple SPI channels.

After activating SPI_MR_PS, the communication between MASTER and SLAVE is incorrect, the data is distorted. I also activated SPI_MR_WDRBT.

I tried different combinations of settings SPI0->SPI_CSR[0] ...SPI_CSR_CSAAT, SPI_CSR_CSNAAT, but I cannot remove the damage of the transferred data.

I wanted to proceed step by step and first I wanted to have proper Master-Slave communication via DMA when setting SPI_MR_PS (to use other free SPI channels).

Can anyone advise how to proceed?

Thank you in advance.

In the attachment there are non-functional files for Master and Slave with active SPI_MR_PS.
08 MASTER-SLAVE OK( SPI_MR_PS not activated).ZIP (11,4 KB)
15 TEST MASTER a MCP4922 wrong(SPI_MR_PS activated).zip (15,1 KB)

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.