-
-
Notifications
You must be signed in to change notification settings - Fork 178
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
Fix compilation error for F091 with SPI #508
Conversation
This board does not have a _STM32_SPII2S_MAX_ #define and its frequency is limited to 12MHz. This 12MHz becomes the default value for boards other than STM32F4xx and STM32F7xx for now.
Hi @MikroBusNet, I'm nanoFramework bot. A human will be reviewing it shortly. 😉 |
#if defined(STM32F4xx_MCUCONF) || defined(STM32F7xx_MCUCONF) | ||
int32_t clock = STM32_SPII2S_MAX >> 1; // SP1, SPI4, SPI5 and SPI6 on APB2 | ||
if (bus == 2 || bus == 3) clock >>= 1; // SPI2 and SPI3 on APB1 | ||
#else |
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.
Guess this should be good for all STM32F0, but might not be for other series.
This should be stressed in the code by add an if defined(STM32F0xx_MCUCONF)
instead of the else
.
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.
Sure but what about "other" MCUs we do not handle or know yet ?
Right now, I am sure only about F4/F7 and F0. That's why I have put default value to an arbitrary one.
Another solution could be to leave the code "as is" and wait a compilation error on the STM32_SPII2S_MAX . In this case we will know for sure which new board we have to handle.
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.
Agreed and totally understandable.
That's why I suggested that change. In order to stress that this appears to be handled "by series" and that we've tested it on F4, 7 and 0.
Adding an elseif for F0 and an else with an #error saying that this needs checking on other F's would help when that time comes.
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 see my comment
... if board is not F0/F4/F7
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
Description
This board does not have a STM32_SPII2S_MAX #define and its frequency is limited to 12MHz.
This 12MHz frequency becomes the default value for boards other than STM32F4xx and STM32F7xx for now.
How Has This Been Tested?
No error at compile time with SPI option ON for the STM32F091 board.
Types of changes
Checklist: