LPC55S69 SPI DMA Example doesn't function properly when changing Flexcomm port

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

LPC55S69 SPI DMA Example doesn't function properly when changing Flexcomm port

Jump to solution
1,205 Views
AveryDauben
Contributor II

When using the spi_dma_b2b example, I simply switched the SPI7 defines and clock source to SPI3, activated it's pins in the pin tool and it stops functioning. Here is the defines I changes, notice how the DMA channels are updated as well for Flexcomm 3.

#define EXAMPLE_SPI_MASTER SPI3
#define EXAMPLE_SPI_MASTER_IRQ FLEXCOMM3_IRQn
#define EXAMPLE_SPI_MASTER_CLK_SRC kCLOCK_Flexcomm3
#define EXAMPLE_SPI_MASTER_CLK_FREQ CLOCK_GetFlexCommClkFreq(3U)
#define EXAMPLE_SPI_SSEL 0
#define EXAMPLE_DMA DMA0
#define EXAMPLE_SPI_MASTER_RX_CHANNEL 10
#define EXAMPLE_SPI_MASTER_TX_CHANNEL 11
#define EXAMPLE_MASTER_SPI_SPOL kSPI_SpolActiveAllLow

Then I change this code for Flexcomm 3 as well:

/* attach 12 MHz clock to SPI3 */
CLOCK_AttachClk(kFRO12M_to_FLEXCOMM3);

/* reset FLEXCOMM for SPI */
RESET_PeripheralReset(kFC3_RST_SHIFT_RSTn);

At this point it stops working, so I believe something in the background is needing to be changed as well, but I'm not familiar with the SPI, DMA or SPI_DMA drivers.

Thank you for your help!

Labels (2)
Tags (3)
0 Kudos
Reply
1 Solution
1,165 Views
Habib_MS
NXP Employee
NXP Employee

Hello @AveryDauben,

The DMA has a separate DMA request for each Flexcomm, as shown in the following image:

Habib_MS_0-1744062424504.png


If you wish to modify the Flexcomm, it is essential to modify these channels. For example, channels 18 and 19 correspond to the Flexcomm 7 interface, which is why the macros are defined as follows:

#define EXAMPLE_SPI_MASTER_RX_CHANNEL 18
#define EXAMPLE_SPI_MASTER_TX_CHANNEL 19


Also, if you experience any issue, does not hesitate to let me know.

BR
Habib.

View solution in original post

0 Kudos
Reply
4 Replies
1,166 Views
Habib_MS
NXP Employee
NXP Employee

Hello @AveryDauben,

The DMA has a separate DMA request for each Flexcomm, as shown in the following image:

Habib_MS_0-1744062424504.png


If you wish to modify the Flexcomm, it is essential to modify these channels. For example, channels 18 and 19 correspond to the Flexcomm 7 interface, which is why the macros are defined as follows:

#define EXAMPLE_SPI_MASTER_RX_CHANNEL 18
#define EXAMPLE_SPI_MASTER_TX_CHANNEL 19


Also, if you experience any issue, does not hesitate to let me know.

BR
Habib.

0 Kudos
Reply
1,107 Views
AveryDauben
Contributor II
@Habib_MS

Hello,
could you please attach the file that you are looking at? The Dual-DMA usage pdf on the LPC55S6x page is not fully up-to-date. Thank you!
0 Kudos
Reply
1,022 Views
Habib_MS
NXP Employee
NXP Employee

Hello @AveryDauben,

The table was taken from the user manual, which you can find on this page:

Habib_MS_1-1744646940073.png

BR
Habib.

0 Kudos
Reply
1,144 Views
AveryDauben
Contributor II

Thank you, this fixed the issue. I must've had an outdated version of the DMA channels as FlexComm 2 and 3 aren't switched on this pdf.

0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-2073981%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ELPC55S69%20SPI%20DMA%20Example%20doesn't%20function%20properly%20when%20changing%20Flexcomm%20port%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2073981%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EWhen%20using%20the%20spi_dma_b2b%20example%2C%20I%20simply%20switched%20the%20SPI7%20defines%20and%20clock%20source%20to%20SPI3%2C%20activated%20it's%20pins%20in%20the%20pin%20tool%20and%20it%20stops%20functioning.%20Here%20is%20the%20defines%20I%20changes%2C%20notice%20how%20the%20DMA%20channels%20are%20updated%20as%20well%20for%20Flexcomm%203.%3C%2FP%3E%3CP%3E%23define%20EXAMPLE_SPI_MASTER%20SPI3%3CBR%20%2F%3E%23define%20EXAMPLE_SPI_MASTER_IRQ%20FLEXCOMM3_IRQn%3CBR%20%2F%3E%23define%20EXAMPLE_SPI_MASTER_CLK_SRC%20kCLOCK_Flexcomm3%3CBR%20%2F%3E%23define%20EXAMPLE_SPI_MASTER_CLK_FREQ%20CLOCK_GetFlexCommClkFreq(3U)%3CBR%20%2F%3E%23define%20EXAMPLE_SPI_SSEL%200%3CBR%20%2F%3E%23define%20EXAMPLE_DMA%20DMA0%3CBR%20%2F%3E%23define%20EXAMPLE_SPI_MASTER_RX_CHANNEL%2010%3CBR%20%2F%3E%23define%20EXAMPLE_SPI_MASTER_TX_CHANNEL%2011%3CBR%20%2F%3E%23define%20EXAMPLE_MASTER_SPI_SPOL%20kSPI_SpolActiveAllLow%3C%2FP%3E%3CP%3EThen%20I%20change%20this%20code%20for%20Flexcomm%203%20as%20well%3A%3C%2FP%3E%3CP%3E%2F*%20attach%2012%20MHz%20clock%20to%20SPI3%20*%2F%3CBR%20%2F%3ECLOCK_AttachClk(kFRO12M_to_FLEXCOMM3)%3B%3C%2FP%3E%3CP%3E%2F*%20reset%20FLEXCOMM%20for%20SPI%20*%2F%3CBR%20%2F%3ERESET_PeripheralReset(kFC3_RST_SHIFT_RSTn)%3B%3CBR%20%2F%3E%3CBR%20%2F%3EAt%20this%20point%20it%20stops%20working%2C%20so%20I%20believe%20something%20in%20the%20background%20is%20needing%20to%20be%20changed%20as%20well%2C%20but%20I'm%20not%20familiar%20with%20the%20SPI%2C%20DMA%20or%20SPI_DMA%20drivers.%3CBR%20%2F%3E%3CBR%20%2F%3EThank%20you%20for%20your%20help!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2073981%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CLINGO-LABEL%3ELPC55xx%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EPeripherals%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2080135%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20LPC55S69%20SPI%20DMA%20Example%20doesn't%20function%20properly%20when%20changing%20Flexcomm%20port%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2080135%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHello%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F248824%22%20target%3D%22_blank%22%3E%40AveryDauben%3C%2FA%3E%2C%3C%2FP%3E%0A%3CP%3EThe%20table%20was%20taken%20from%20the%20user%20manual%2C%20which%20you%20can%20find%20on%20this%20%3CA%20href%3D%22https%3A%2F%2Fwww.nxp.com%2Fproducts%2FLPC55S6x%23documentation%22%20target%3D%22_self%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Epage%3C%2FA%3E%3A%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Habib_MS_1-1744646940073.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Habib_MS_1-1744646940073.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F332967i364B6328AB14B1EF%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Habib_MS_1-1744646940073.png%22%20alt%3D%22Habib_MS_1-1744646940073.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EBR%3CBR%20%2F%3EHabib.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2079326%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20LPC55S69%20SPI%20DMA%20Example%20doesn't%20function%20properly%20when%20changing%20Flexcomm%20port%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2079326%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F231807%22%20target%3D%22_blank%22%3E%40Habib_MS%3C%2FA%3E%3CBR%20%2F%3E%3CBR%20%2F%3EHello%2C%3CBR%20%2F%3Ecould%20you%20please%20attach%20the%20file%20that%20you%20are%20looking%20at%3F%20The%20Dual-DMA%20usage%20pdf%20on%20the%20LPC55S6x%20page%20is%20not%20fully%20up-to-date.%20Thank%20you!%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2076451%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20LPC55S69%20SPI%20DMA%20Example%20doesn't%20function%20properly%20when%20changing%20Flexcomm%20port%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2076451%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EThank%20you%2C%20this%20fixed%20the%20issue.%20I%20must've%20had%20an%20outdated%20version%20of%20the%20DMA%20channels%20as%20FlexComm%202%20and%203%20aren't%20switched%20on%20this%20pdf.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2075458%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20LPC55S69%20SPI%20DMA%20Example%20doesn't%20function%20properly%20when%20changing%20Flexcomm%20port%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2075458%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHello%20%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F248824%22%20target%3D%22_blank%22%3E%40AveryDauben%3C%2FA%3E%2C%3C%2FP%3E%0A%3CP%3EThe%20DMA%20has%20a%20separate%20DMA%20request%20for%20each%20Flexcomm%2C%20as%20shown%20in%20the%20following%20image%3A%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Habib_MS_0-1744062424504.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Habib_MS_0-1744062424504.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F331701iEDAA9B34E6453B90%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Habib_MS_0-1744062424504.png%22%20alt%3D%22Habib_MS_0-1744062424504.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CBR%20%2F%3EIf%20you%20wish%20to%20modify%20the%20Flexcomm%2C%20it%20is%20essential%20to%20modify%20these%20channels.%20For%20example%2C%20channels%2018%20and%2019%20correspond%20to%20the%20Flexcomm%207%20interface%2C%20which%20is%20why%20the%20macros%20are%20defined%20as%20follows%3A%3C%2FP%3E%0A%3CP%3E%23define%20EXAMPLE_SPI_MASTER_RX_CHANNEL%2018%3CBR%20%2F%3E%23define%20EXAMPLE_SPI_MASTER_TX_CHANNEL%2019%3C%2FP%3E%0A%3CP%3E%3CBR%20%2F%3EAlso%2C%20if%20you%20experience%20any%20issue%2C%20does%20not%20hesitate%20to%20let%20me%20know.%3C%2FP%3E%0A%3CP%3EBR%3CBR%20%2F%3EHabib.%3C%2FP%3E%3C%2FLINGO-BODY%3E