Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

drivers: dma: stm32 dmamux device is passed to the dma device #30041

Merged
merged 4 commits into from
Dec 27, 2020

Conversation

FRASTM
Copy link
Collaborator

@FRASTM FRASTM commented Nov 16, 2020

The dmamux device reference is passed to the associated dma device during the dmamux_stm32_configure()
through the user_data field of the dma_config structure.
So that, later on the incoming dma irq, the dma knows the dmamux where to route its callback function

This is demonstrated using the tests/drivers/dma/loop_transfer and tests/drivers/dma/chan_blen_transfer running on the stm32wb55 nucleo board.

fixes #29992

@github-actions github-actions bot added area: Devicetree area: Devicetree Binding PR modifies or adds a Device Tree binding area: Tests Issues related to a particular existing or missing test platform: STM32 ST Micro STM32 labels Nov 16, 2020
@FRASTM FRASTM force-pushed the issue29992 branch 6 times, most recently from af1d2a8 to ea8790b Compare November 16, 2020 10:30
@FRASTM
Copy link
Collaborator Author

FRASTM commented Nov 16, 2020

testing tests/drivers/dma/loop_transfer on nucleo_wb55rg:

*** Booting Zephyr OS build zephyr-v2.4.0-1463-g44c480e8d157  ***                                                    
DMA memory to memory transfer started on DMAMUX_1                                                                    
Preparing DMA Controller                                                                                             
Starting the transfer and waiting for 1 second                                                                       
TX data: The quick brown fox jumps over the lazy dog ....                                                            
block_size 48                                                                                                        
Each RX buffer should contain the full TX buffer string.                                                             
TX data: The quick brown fox jumps over the lazy dog ....                                                            
RX data Loop 0: The quick brown fox jumps over the lazy dog ....                                                     
RX data Loop 1: The quick brown fox jumps over the lazy dog ....                                                     
RX data Loop 2: The quick brown fox jumps over the lazy dog ....                                                     
RX data Loop 3: The quick brown fox jumps over the lazy dog ....                                                     
RX data Loop 4: The quick brown fox jumps over the lazy dog ....                                                     
Finished: DMA 

@FRASTM FRASTM force-pushed the issue29992 branch 2 times, most recently from 9718f99 to ed3ef43 Compare November 17, 2020 11:35
Copy link
Member

@erwango erwango left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please clear CONFIG_DMA_MCUX_TEST_SLOT_START from the commit messages.
One copyright remains to be fixed.

Otherwise LGTM

Copy link
Collaborator

@ABOSTM ABOSTM left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@FRASTM
Copy link
Collaborator Author

FRASTM commented Nov 25, 2020

this PR must be reworked as the tests/drivers/spi/spi_loopback now fails:

START - test_spi_loopback                                                       
I: SPI test on buffers TX/RX 0x2000019d/0x20000e9a                              
I: SPI test slow config                                                         
I: Start complete multiple                                                      
I: CS control inhibited (no GPIO device)                                        
E: DMA callback channel 11 is not valid.                                        
E: ***** MPU FAULT *****                                                        
E:   Data Access Violation   

@erwango erwango added the DNM This PR should not be merged (Do Not Merge) label Nov 25, 2020
@erwango erwango self-requested a review November 25, 2020 08:05
@erwango erwango requested a review from ABOSTM November 25, 2020 08:05
@erwango
Copy link
Member

erwango commented Nov 25, 2020

@FRASTM please let us know when everything is fine

It adds flexibility to test different dma channels
The chan_blen_transfer is modified
like the loop_transfer application to support stm32xx devices
with dma and/or dmamux.
On the stm32 devices, the first dma channel is 1.

Signed-off-by: Francois Ramu <[email protected]>
The dma test applications for MEM-to-MEM transfers are modified
to run on the stm32wb55 with a DMAMUX
loop_transfer on any CONFIG_DMA_LOOP_TRANSFER_CHANNEL_NR from 0 to 13
chan_blen_trasnfer on CONFIG_DMA_TRANSFER_CHANNEL_NR_0 from 0 to 13
and on CONFIG_DMA_TRANSFER_CHANNEL_NR_1 from 0 to 13

Signed-off-by: Francois Ramu <[email protected]>
The dma test applications for MEM-to-MEM transfers are modified
to run on the stm32l476 with a DMA.
The CONFIG_DMA_LOOP_TRANSFER_DRV_NAME is either DMA_1 or DMA_2
CONFIG_DMA_LOOP_TRANSFER_CHANNEL_NR from 1 to 7 for DMA_1
CONFIG_DMA_LOOP_TRANSFER_CHANNEL_NR from 1 to 5 for DMA_2

Signed-off-by: Francois Ramu <[email protected]>
@FRASTM
Copy link
Collaborator Author

FRASTM commented Nov 25, 2020

With this fix, only the tests/drivers/dma applications are modified to include the support of the DMAMUX on some stm32 devices (typ. stm32wb55rg). In this case, the callback function (dma_user_callback) of the tests/drivers/dma/loop_back must refer to the DMAMUX (not DMA) device, even if the irq is trigger by the DMA. This DMAMUX device is stored in the dma_cfg.user_data during the application init. At this time, the dma devices refers to the DMAMUX instance.

@FRASTM
Copy link
Collaborator Author

FRASTM commented Nov 25, 2020

with this fix and connecting SPI 1 MISO to MOSI (PA7 = PA6 on CN10 of the nucleo_wb55rg board)

*** Booting Zephyr OS build zephyr-v2.4.0-1767-gf46d3a888154  ***               
Running test suite test_spi                                                     
===================================================================             
START - test_spi_loopback                                                       
I: SPI test on buffers TX/RX 0x200001a1/0x20000ea6                              
I: SPI test slow config                                                         
I: Start complete multiple                                                      
I: CS control inhibited (no GPIO device)                                        
I: Passed                                                                       
I: Start complete loop                                                          
I: Passed                                                                       
I: Start null tx                                                                
I: Passed                                                                       
I: Start half start                                                             
I: Passed                                                                       
I: Skip half end                                                                
I: Skip every 4                                                                 
I: SPI test fast config                                                         
I: Start complete multiple                                                      
I: CS control inhibited (no GPIO device)                                        
I: Passed                                                                       
I: Start complete loop                                                          
I: Passed                                                                       
I: Start null tx                                                                
I: Passed                                                                       
I: Start half start                                                             
I: Passed                                                                       
I: Skip half end                                                                
I: Skip every 4                                                                 
I: Start complete loop                                                          
I: CS control inhibited (no GPIO device)                                        
I: Passed                                                                       
I: Start complete loop                                                          
I: CS control inhibited (no GPIO device)                                        
I: Passed                                                                       
I: All tx/rx passed                                                             
 PASS - test_spi_loopback                                                       
===================================================================             
Test suite test_spi succeeded                                                   
===================================================================             
PROJECT EXECUTION SUCCESSFUL  

Copy link
Member

@erwango erwango left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but please add "dma" support in board yaml files, so this can be tested in CI.

This will add the corresponding tests/drivers/dma/ tests
to the sanity check

Signed-off-by: Francois Ramu <[email protected]>
@erwango erwango removed the DNM This PR should not be merged (Do Not Merge) label Dec 17, 2020
@carlescufi carlescufi merged commit 8cb7777 into zephyrproject-rtos:master Dec 27, 2020
@FRASTM FRASTM deleted the issue29992 branch August 16, 2022 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Boards area: Devicetree Binding PR modifies or adds a Device Tree binding area: Devicetree area: Tests Issues related to a particular existing or missing test platform: STM32 ST Micro STM32
Projects
None yet
Development

Successfully merging this pull request may close these issues.

dma tests fail with stm32wb55 and stm32l476 nucleo boards
4 participants