Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pico-sdk
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Microcontroller
pico-sdk
Commits
8b0146c1
Unverified
Commit
8b0146c1
authored
1 year ago
by
aizaki77
Committed by
GitHub
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
Fixed an issue that caused incorrect settings when the SPI clock was less than 244141Hz. (#1633)
parent
f5b7a913
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/rp2_common/hardware_spi/spi.c
+1
-1
1 addition, 1 deletion
src/rp2_common/hardware_spi/spi.c
with
1 addition
and
1 deletion
src/rp2_common/hardware_spi/spi.c
+
1
−
1
View file @
8b0146c1
...
@@ -51,7 +51,7 @@ uint spi_set_baudrate(spi_inst_t *spi, uint baudrate) {
...
@@ -51,7 +51,7 @@ uint spi_set_baudrate(spi_inst_t *spi, uint baudrate) {
// Find smallest prescale value which puts output frequency in range of
// Find smallest prescale value which puts output frequency in range of
// post-divide. Prescale is an even number from 2 to 254 inclusive.
// post-divide. Prescale is an even number from 2 to 254 inclusive.
for
(
prescale
=
2
;
prescale
<=
254
;
prescale
+=
2
)
{
for
(
prescale
=
2
;
prescale
<=
254
;
prescale
+=
2
)
{
if
(
freq_in
<
(
prescale
+
2
)
*
256
*
(
uint64_t
)
baudrate
)
if
(
freq_in
<
prescale
*
256
*
(
uint64_t
)
baudrate
)
break
;
break
;
}
}
invalid_params_if
(
SPI
,
prescale
>
254
);
// Frequency too low
invalid_params_if
(
SPI
,
prescale
>
254
);
// Frequency too low
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment