- 
                Notifications
    You must be signed in to change notification settings 
- Fork 8.2k
drivers: i2s: stm32_sai add support for stm32l4xx series #95021
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
Conversation
| Logs from my side: We stuck waiting for this:  | 
| Instance seems to be correct (DMA2_Channel1) As I understand dma_slot = 37 from  | 
| 
 This is the same behaviour that I also get 
 
 However  | 
| Now I have  | 
| 
 From an inital look without going into details seems like  | 
53efd8a    to
    f195c5b      
    Compare
  
    | @evgeniy-paltsev Issue found, SAI should work now without problems The issue was DMA Channel. On STM32L4xx DMA channel  is given from 0 - 7 | 
| Haven't tried to connect real I2S peripheral yet - but at least DMA seems to be working now :) | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dma_slot = 37 is an arbitrary number set by me, but as you said it has no affect to the DMA configuration. To tell the truth I dont know why dma_slot is required in the binding, or why it is implemented at the first place.
However dma_cfg.dma_slot return 0x25 and I dont know where this value comes from, this is the reason why I am setting the request number to DMA_REQUEST_1
IMO, that's quite simple. We just need to use request number in slot field in dts.
| 
 I wrote it down. I will check it and open a dedicated PR for that 😄 Since there are two issues with the H7 DMA I will open a new PR:  | 
dba4b52    to
    3bf0129      
    Compare
  
    3bf0129    to
    74f9d5d      
    Compare
  
    There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM aside some minor issues.
        
          
                dts/arm/st/l4/stm32l4.dtsi
              
                Outdated
          
        
      | #address-cells = <1>; | ||
| #size-cells = <0>; | ||
| reg = <0x40015404 0x20>; | ||
| clocks = <&rcc STM32_CLOCK(APB2, 21U)>, | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For consistency in STM32 SoCs DTSI files (be kind my @mathieuchopstm, see #93912):
| clocks = <&rcc STM32_CLOCK(APB2, 21U)>, | |
| clocks = <&rcc STM32_CLOCK(APB2, 21)>, | 
Ditto for sai1_b below.
        
          
                drivers/i2s/i2s_stm32_sai.c
              
                Outdated
          
        
      | return -EINVAL; | ||
| } | ||
|  | ||
| /* STM32L4xx not possible to control MCLK output from SAI configuration */ | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| /* STM32L4xx not possible to control MCLK output from SAI configuration */ | |
| /* Control of MCLK output from SAI configuration is not possible on STM32L4xx MCUs */ | 
        
          
                drivers/i2s/i2s_stm32_sai.c
              
                Outdated
          
        
      | 4); | ||
|  | ||
| DT_INST_FOREACH_STATUS_OKAY(I2S_STM32_SAI_INIT) | ||
| DT_INST_FOREACH_STATUS_OKAY(I2S_STM32_SAI_INIT) | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please discard this change straight from commit "drivers: i2s: i2s_stm32_sai add support for stm32l4xx".
        
          
                dts/arm/st/l4/stm32l4.dtsi
              
                Outdated
          
        
      | dmas = <&dma2 1 1 (STM32_DMA_MODE_NORMAL | STM32_DMA_PRIORITY_HIGH | | ||
| STM32_DMA_16BITS)>; | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpicking on indentation. Would be better as:
		dmas = <&dma2 1 1 (STM32_DMA_MODE_NORMAL | STM32_DMA_PRIORITY_HIGH |
				   STM32_DMA_16BITS)>;Add SAI1 A & B nodes for STM32L4xx series Signed-off-by: Mario Paja <[email protected]>
STM32L4xx series shares several SAI & DMA configurations with the other platforms. These changes aim to remove specific DMA & SAI configurations which are not used by STM32L4xx Signed-off-by: Mario Paja <[email protected]>
Add nucleo_l432kc in samples/drivers/i2s/output Signed-off-by: Mario Paja <[email protected]>
74f9d5d    to
    53d39a3      
    Compare
  
    | 
 | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested on STM32L431RCT6 + max98357a.
NOTE: tested TX part only on sai1_a.




This PR enables SAI on STM32L4xx series by:
samples/drivers/i2s/output