- 
                Notifications
    You must be signed in to change notification settings 
- Fork 8.2k
Enabling SPI ports on some nucleos #6172
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
Enabling SPI ports on some nucleos #6172
Conversation
| @tbursztyka : You might want to rebase on #5883. | 
| Codecov Report
 @@            Coverage Diff            @@
##           master    #6172     +/-   ##
=========================================
- Coverage   53.15%   52.86%   -0.3%     
=========================================
  Files         412      412             
  Lines       40139    40284    +145     
  Branches     7732     7802     +70     
=========================================
- Hits        21337    21296     -41     
- Misses      15667    15773    +106     
- Partials     3135     3215     +80
 Continue to review full report at Codecov. 
 | 
| @erwango thx, missed that pr. there is most probably redundant things then | 
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.
@tbursztyka I will check it again when you rebase it on #5883.
        
          
                dts/arm/st/stm32f1.dtsi
              
                Outdated
          
        
      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.
SPI3 is not available on stm32f103xb. You should move it inside stm32f103Xe.dtsi and stm32f107.dtsi.
        
          
                dts/arm/st/stm32f0.dtsi
              
                Outdated
          
        
      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.
spi2 is not present on all f0 SoCs so it shouldn't be in this place.
I'd propse adding an stm32f030Xc.dtsi and a stm32f030X8.dtsi file and adding the node there.
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.
I thought changing the status to "ok" in relevant board would be sufficient. (one that support only spi1, or both etc...), since the base address seems to be the same (well, as you noticed below: if f09x or f07x has spi2 support but with different base address then splitting in relevant files will be necessary)
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.
there's been some discussion on this in #5883, eg this: #5883 (comment)
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.
I did what you proposed yes
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.
Haven't looked into it, but are they present on other f0 SoCs as well? f091, f072?
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.
Maybe, I only looked at f030x specs. We can add support for f09x, f07x later
7874721    to
    c89d938      
    Compare
  
    | Rebased on top of #5883 and updated : I removed 2 patches that were then unnecessary. | 
0b764c5    to
    5764db0      
    Compare
  
    | recheck | 
| @tbursztyka rebase on #5883 again. There were some CI problems solved yesterday by #6223 | 
5764db0    to
    9b674a7      
    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.
Right now, enabling SPIx port in dts is not enough. You should also enable SPIx ports in board's Kconfig.defconfig file for boards with STM32 SoC.
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.
You should also enable SPI_1 port in board's Kconfig.defconfig.
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.
Same here.
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.
You should also enable SPI_1 port in board's Kconfig.defconfig.
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.
Same here.
| @ydamigos I did not do it on purpose: why enabling a port by default if it's not in use? I'd rather let the user do that, depending on his need. | 
| @tbursztyka The user might get confused to see them enabled in the dts file. For example, spi_loopback compiles fine but it won't work on the board. | 
| @ydamigos ok, well after users should know what they are doing so if they have unused spi port there, up to them to disable these. Will update | 
9b674a7    to
    c2922f1      
    Compare
  
            
          
                dts/arm/st/stm32f030X8.dtsi
              
                Outdated
          
        
      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.
As mentioned in #6238, SPI irq priority cannot be 5.
        
          
                dts/arm/st/stm32f030Xc.dtsi
              
                Outdated
          
        
      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.
same here
c2922f1    to
    133650c      
    Compare
  
    This feature is available on STM32F030x8 and STM32F030xC. Signed-off-by: Tomasz Bursztyka <[email protected]>
Other variants exist. Signed-off-by: Tomasz Bursztyka <[email protected]>
Current configuration was choosen to avoid colliding with existing ones for i2c and uart, but others can be used (see drivers/pinmux/stm32/stm32_f0.h) Signed-off-by: Tomasz Bursztyka <[email protected]>
Current configuration was choosen to avoid colliding with existing ones for i2c and uart, but others can be used. Signed-off-by: Tomasz Bursztyka <[email protected]>
133650c    to
    04b8505      
    Compare
  
    | @ydamigos can you review it again? Sounds like it's good to go (hopefully) | 
Hello,
While testing something on SPI that required to use stm32's, and since I had these nucleos, I enabled the SPI ports relevantly there.
I could successfully test nucleo_f103rb and nucleo_f334r8
@erwango My nucleo_f030r8 st-link acting weirdly as you know I could not test yet (I'll do you trick of using an external st-link). But I believe it should be fine. The only thing which I have a doubt about is the NSS pinmuxing: should it has a pull up?