-
Notifications
You must be signed in to change notification settings - Fork 2k
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
boards/opencm9-04 : initial support #6388
Conversation
Thanks, this board looks great. Your port is still missing a I guess you can keep the same CLOCK definition macros and, from the schematic, configure 1 or 2 UARTs (PA2/PA3 and PA9/PA10). For the user LED, I don't see what's the pin mapping. |
According to the schematic, the STATUS_LED(GREEN) should be linked with D14, or PB9. |
The LED problem seemed to be a linker script broblem. Indeed, the bootloader need the program to begin at an other address thant the default one. |
Here is my problem : I can't run the main function because the program has a problem before getting to the main. And I reach the function thread_arch_start_threading which triggers an "svc" interrupt. And then I don't know where go the execution thread. I think the interrupt vector is not found by the microcontroller. Indeed, the board has a bootloader by default, and the user program don't start at 0x08000000 but at 0x08003000 (I use a custom ldscript). So that the vector is not where it should be... Does someone has an idea on how I can fix this ? |
Thanks @astralien3000 for the in-depth diagnosis. Good job !
This is out of my knowledge but maybe @kaspar030 or @haukepetersen can help ? |
Some good update ! SCB->VTOR = CPU_FLASH_BASE; CPU_FLASH_BASE is equal to 0x08000000 not depending on what is in the linker script. If I replace this line by : SCB->VTOR = 0x08003000; I can go to the main ! But it is dirty, and I don't know what would be the clean way to do the same. |
Hmm :
Why is the dummy handler triggered since there is no dummy handler in the stm32f1's vector implementation ? |
Better use this line in the cmsis file. Then you need to create a dedicated one for your board and play with the defines to include the right one. |
I have done like the
|
Is the bootloader really needed? cannot you overwrite it to start at address 0x08000000 ? What are you using to flash the device? |
I use the bootloader ^^ |
And which kind of bootloader it has? it's not FTDI or CMSIS-DEP based? (like iotlab-m3 or samr21-xpro) |
I think it is a custom one, made by ROBOTIS (the board's vendor). I use a custom python program (also made by ROBOTIS) to load the code to the board. |
Good news : I disabled the USB in board_init, and everything seem to work fine. |
@kYc0o the bootloader is never needed when you have a JTAG, but I had none for the past few days, and it also would oblige people to buy one... Also, It is possible to handle both configuration : one using the bootloader which need some hacks to work well, and one using the JTAG (2 separate "boards" ?) |
OK I see, then yes you need to change the |
👍 That would be the way I would implement it ! ^^ Also, I put the linker script in the |
51a67d9
to
da5bb9f
Compare
Concerning the problem of robotis-loader.py, which has no license header, I added the README from the author's repository, which says that is under MIT. |
/** @} */ | ||
|
||
/** | ||
* @name Macros for controlling the on-board LEDs. |
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.
LED: there's only one
Except from a minor cosmetic comment, changes looks good: untested ACK |
I forgot: please squash ;) |
I think the standard way is to insert a MIT license header in the robotis-loader.py file, as well as the name of the author. |
# custom linkerscript | ||
export LINKER_SCRIPT = stm32f103cb_opencm9-04.ld | ||
|
||
# custom flasher to ust with the bootloader |
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.
ust ?
@@ -0,0 +1,23 @@ | |||
## the cpu to build for |
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.
2 ##
/* initialize the CPU */ | ||
cpu_init(); | ||
|
||
/* initialize the boards LEDs */ |
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 you changed LEDs
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 I did not miss one ;)
port = os.environ["PORT"] | ||
binary = os.environ["HEXFILE"] | ||
|
||
# Helper to prints a progress bar |
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.
prints
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.
that
instead of to
is better and keep prints
* @author Loïc Dauphin <loic.dauphin@inria.fr> | ||
*/ | ||
|
||
#ifndef BOARD_H_ |
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.
Trailing underscores should be removed see #6407
* @author Loïc Dauphin <loic.dauphin@inria.fr> | ||
*/ | ||
|
||
#ifndef PERIPH_CONF_H_ |
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.
trailing underscore
#define I2C_1_SDA_PIN GPIO_PIN(PORT_B, 11) /* D0 */ | ||
/** @} */ | ||
|
||
/** |
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 don't want to use SPI and there's a big PR about that #4780. I propose to remove the SPI definitions from this file and the dependency from the Makefile.deps.
#define BTN_B1_PIN GPIO_PIN(PORT_C, 15) | ||
|
||
/** | ||
* @brief Use the USART1 for STDIO on this board |
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.
If you set UART_DEV(0) then, according to the board config, it should be USART2 (not USART1)
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 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.
oups sorry, I did not understood
d63b0da
to
4c1878f
Compare
I have problems flashing the board : the flasher code is a bit a mess and not python 3 compatible... |
Ok, I think I fixed it |
Should I modify the script to make it easier to use ? Or is it OK ? |
The usage is ok. It's just that it's absolutely not python 3 compatible |
@astralien3000 Can you also add some notes about how to flash the board in a README ? |
Is it better "in the code" or the wiki ? |
813c414
to
b6e3c7e
Compare
I think both are ok. I could test the board with success using |
b6e3c7e
to
5c4bee1
Compare
I have added a HOWTO text in the loader, is it ok ? |
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.
ACK when CIs are green
Hello !
This is just a work in progress, because I am currently only able to make the custom FLASHER work.
I am not even able to make a led blink...
Here are the best information I can get on this board :
http://support.robotis.com/en/product/controller/opencm9.04.htm