Skip to content
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

I added support to run cantact-fw on STM32F072B-DISCO and build files for MDK-ARM/Keil #20

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

trollcop
Copy link

@trollcop trollcop commented Dec 12, 2020

Since STM32F072B-DISCO is kinda ubiquitous and can be had for $12 I've added support to run cantact-fw on this board.
An external canbus transceiver breakout can be connected to VDD/PB8/PB9/GND pins on the -DISCO easily. No soldering or modifications needed on the board.

During making the port, I made LED pins configurable, fixed some compile/style warnings and properly fixed running off internal oscillator (072B-DISCO doesn't have a crystal mounted).

I don't have a linklayer board to test with but the changes are pretty simple and should not affect operation on original board.

Oh, and I added build files for MDK-ARM v4, shouldn't hurt anyone I suppose.

Made LED pins/GPIO configurable instead of hardcoded.
Corrected HSI48 init code (did not work out of the box on -disco, didn't bother investigating why, just replaced with working code)
@jxltom
Copy link

jxltom commented Jan 19, 2021

  1. It might be better if makefile is also updated based on stm32f072
  2. It is also better to update startup_*.s file
  3. It will be nice to support two led with different port such as GPIOB and GPIOC

…ULID_HW=disco, default cantact, if no arguments specified)

Added (well, actually copied from CMSIS template folder) startup/linker files for stmf072 for gcc build
Made LED GPIO ports selectable for each LED (still need to edit LED_GPIO_CLK by the user but at that point they should know what they're doing)
@trollcop
Copy link
Author

trollcop commented Jan 19, 2021

Allright, I added a new commit taking care of those requests (I don't use gcc/Makefile but I tested both builds and they work).
I'm not sure why its not showing up in the list here but the last commit is here: trollcop@abca338

can be invoked as just make for cantact default, or make BUILD_HW=disco for the -discovery build.

@jxltom
Copy link

jxltom commented Jan 19, 2021

This is nice.

Just one more thing, maybe it is better to define seperate LED_RED_GPIO_CLK and LED_GREEN_GPIO_CLK to support different ports?

@trollcop
Copy link
Author

This is nice.

Just one more thing, maybe it is better to define seperate LED_RED_GPIO_CLK and LED_GREEN_GPIO_CLK to support different ports?

I've left a comment in the PR regarding that - there's no simple way other than duplicating the define, and at the point where a user need to change this they probably know what they're doing. If you have a suggestion of how to implement it better than something like

#define LED_GREEN_GPIO_CLK    __GPIOB_CLK_ENABLE
#define LED_RED_GPIO_CLK    __GPIOB_CLK_ENABLE

I'm all ears, or else it can just be made that way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants