Skip to content

cpu/stm32f4: Fix SPI baud rate control settings#2315

Merged
haukepetersen merged 3 commits intoRIOT-OS:masterfrom
fnack:spi_clock
Jan 16, 2015
Merged

cpu/stm32f4: Fix SPI baud rate control settings#2315
haukepetersen merged 3 commits intoRIOT-OS:masterfrom
fnack:spi_clock

Conversation

@fnack
Copy link
Copy Markdown
Member

@fnack fnack commented Jan 16, 2015

The baudrate control for the SPIs are currently not set correctly during initialization. The SPIs on the stm32f4xx series run either on the APB1 or the APB2 bus which are clocked differently (APB1=42MHz, APB2=84MHz). Therefore during spi initialization we need to distinguish between the two possible clock rates to compute our prescaler.

Additionally, the previously configured prescalers were wrong as well and didn't lead to the desired speed on either bus. Please refer to baud rate control bits in the control register at page 905 of the reference manual where f_pclk is the clock speed of the used bus.

@fnack fnack added Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors) Platform: ARM Platform: This PR/issue effects ARM-based platforms labels Jan 16, 2015
@fnack
Copy link
Copy Markdown
Member Author

fnack commented Jan 16, 2015

Would be great if someone (@PeterKietzmann, @haukepetersen) could test this with a logic analyzer for one SPI on APB1 and one on APB2.

@PeterKietzmann
Copy link
Copy Markdown
Member

Whoops, that must have been my fault. I'll test this!

@PeterKietzmann
Copy link
Copy Markdown
Member

I tested the speed values for both ports. Now they're correct. Nice you found this. ACK

@haukepetersen
Copy link
Copy Markdown
Contributor

ACK also from my side -> and go.

haukepetersen added a commit that referenced this pull request Jan 16, 2015
cpu/stm32f4: Fix SPI baud rate control settings
@haukepetersen haukepetersen merged commit c3cdfe7 into RIOT-OS:master Jan 16, 2015
jnohlgard pushed a commit to jnohlgard/RIOT that referenced this pull request Jan 19, 2015
The delays were introduced in an attempt to fix "inexplicable timing
errors", although the errors were in the SPI bus driver rather than the
nrf24l01p driver.

See also:
 - RIOT-OS#1704
 - RIOT-OS#2315

Signed-off-by: Joakim Gebart <[email protected]>
jnohlgard pushed a commit to jnohlgard/RIOT that referenced this pull request Jan 19, 2015
The delays were introduced in an attempt to fix "inexplicable timing
errors", although the errors were in the SPI bus driver rather than the
nrf24l01p driver.

See also:
 - RIOT-OS#1704
 - RIOT-OS#2315

Signed-off-by: Joakim Gebart <[email protected]>
@fnack fnack deleted the spi_clock branch March 13, 2015 13:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Platform: ARM Platform: This PR/issue effects ARM-based platforms Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants