Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
9 years, 6 months ago.
Using mbed with generic STM32F103C8T6 cheap eBay boards
Hi, on eBay there are many cheap board with STM32F103C8T6. Unfortunately mbed does not support this.
eBay boards:
http://www.ebay.com/itm/321569700934 - like Arduino Nano ($4.6)
http://www.ebay.com/itm/291287755025 - more IO pins ($6.4)
http://www.ebay.com/itm/181617148613 - more IO pins ($7.3)
http://www.ebay.com/itm/141456471471 - only CPU without board ($1.6)
STM32F103C8T6 is great for home DIY project as 8bit Arduino replacement.
mbed support NUCLEO-F103RB which has similar CPU - STM32F103RBT6. But is is not full compatible with STM32F103C8T6.
It would be best to support only STM32F103C8T6 CPU without any board. Look at schema, it is very simple (or PDF)
Could someone please port mbed to STM32F103C8T6? I would like to use STM32F103C8T6 on my own PCB - no devboard. Support in web compiler will be great. I like to send money to PayPal for your help.
4 Answers
9 years, 6 months ago.
You may install a offline compiler , like gcc-arm.
You have access to the linker file and it is easy to change the flash size
There remain one problem for the pins names : the C8 as less pins. You may have to change the PinNames.h
Look at this info http://developer.mbed.org/forum/bugs-suggestions/topic/1633/
I hope this can help you .
Hi,
I've already purchased one of these cheap modules with STM32F103C8T6 chip onboard and my experience is that you can even use the mbed online compiler set for the NUCLEO-F103RB board. Just make sure that the generated binary does not exceed 64kB to fit into the flash of his smaller brother. Also the pin labels indicated on the board do match the NUCLEO board's blue/white pin names. Only the leading 'P' is missing and there is no underscore ('_') between the characters and digits :). However, please notice that not all pins from the NUCLEO-F103RB are present.
posted by 20 Apr 20158 years, 4 months ago.
There is some hope, see https://github.com/mbedmicro/mbed/pull/1880
I doubt these boards will be supported by online compiler, but you should be able to use any desktop IDE for development. PlatformIO already stated the interest in including support for these boards in their toolkit.
8 years, 4 months ago.
Hello,
The STM32F103C8T6 boards can be used straight away with the mbed on-line compiler. See STM32F103C8T6_Hello for more details.
Zoltan
Thank you, for you library. Need help. I took advantage of your library. however, There is a problem. Function wait() does not work right. STM32F103C8T6 is stopted when I used two Timer or two TimeOut or use attach() twice. help!!!
posted by 11 Sep 2016Example:
while(1) {
myled = 0; begin = timer.read_us(); wait(0.2); end = timer.read_us(); pc.printf("Blink 0 delay %d\r\n",(end-begin));
myled = 1; begin = timer.read_us(); wait(1.0); 1 sec end = timer.read_us(); pc.printf("Blink 1 delay %d\r\n",(end-begin));
}
But same times wait(1.0); no 1 sec delay.
Putty on PC:
Blink 0 delay 200200 Blink 1 delay 1001000
Blink 0 delay 200200 Blink 1 delay 50194
Blink 0 delay 200200 Blink 1 delay 1001000
Blink 0 delay 200200 Blink 1 delay 1001000
Blink 0 delay 200200 Blink 1 delay 1001000
Blink 0 delay 200200 Blink 1 delay 22869
Blink 0 delay 200200 Blink 1 delay 1001000
posted by 12 Sep 2016Hello Slava,
Thank you for reporting the issue. Testato notified me about it recently too.
I have tried to run your code on a NUCLEO-F103RB board and the results were similar, i.e. delay times varying randomly. It seems there is a bug in the implementation of the us_ticker_read()
function for the NUCLEO-F103RB platform in the current mbed library (rev. 125). After replacing the mbed library with the mbed-dev source files rev. 146 and modifying the wait_us(int us)
function the results were on both NUCLEO-F103RB and STM32F103C8T6 much better (although not perfect yet). So let's hope that the mbed team will fix this issue soon (caused by incorrect values of counter
variable calculated in the us_ticker_read()
function). Until that I recommend you to use the "mbed-dev" library (instead of the precompiled "mbed") and modify the implementation of the wait_us(int us)
function in the file
mbed-dev/common/mbed_wait_api.c as follows:
mbed_wait_api.c
// ... void wait_us(int us) { uint32_t start = us_ticker_read(); // while ((us_ticker_read() - start) < (uint32_t)us); uint32_t now; do { now = us_ticker_read(); } while(((now - start) < (uint32_t)us) || (now < start)); }
Zoltan
posted by 12 Sep 2016thanks a lot for your analysis of the problem, but i do not understand why if I build the examples by online official compiler, it work (i do not have rpobelm on wait function) Instead if i build the same examples exported to EmBlock the problem appear. The online Mbed library version is not the same of the exported one ?
May you upload a version of the blink examples that include the mbed-dev library modified ? I'm new to Mbed so i do not know how add the mbed-dev library for modifie it.
thank you so much for sharing your work Testato
posted by 13 Sep 2016Hello Testato,
To import the mbed-dev library into your program please carry out the same steps as for any other library:
- Select you target program
- On the toolbar click on the "Import" button
- Select the "Libraries" tab
- Type mbed-dev into the "Search box" and then click on the "Search" button
- After a while you should see a line with info about the mbed-dev library
- Select that line (by clicking on it) and then click on the "Import!" button located just above the "Search" button
Once the mbed-dev library has been imported into your program (it takes a while) you can delete the original mbed library from it.
Then try to recompile your project. Because also the mbed-dev sources have to be compiled it will take much longer then usually.
After that you can try to modify the wait_us()
function. Sadly, the code I suggested above did not take into account that the us_ticker_read()
will roll over back to zero after about 71 minutes. So we better use the following :
void wait_us(int us) { uint32_t start = us_ticker_read(); //while ((us_ticker_read() - start) < (uint32_t)us); uint32_t now; uint32_t end = start + us; if(end < start) { // in case with roll over back to zero do { now = us_ticker_read(); } while((now > start) || (now < end)); } else { // in case without roll over back to zero while(us_ticker_read() < end); } }
I can confirm that such program exported to "CooCox CoIDE" and re-built off-line behaves as the one built on-line.
Zoltan
Hello,
The solution I presented above works but it suggests to change an API function shared by all mbed boards (regardless how they perform). That isn't the right way to do it. We'd better be more specific and fix the issue just for the NUCLEO-F103RB as proposed at THIS link.
Zoltan