avikde / koduino Goto Github PK
View Code? Open in Web Editor NEWArduino code for STM32 microcontrollers
Home Page: http://avikde.me/koduino
License: Other
Arduino code for STM32 microcontrollers
Home Page: http://avikde.me/koduino
License: Other
Hi Avik
I now have a Nucleo STM32F334, so you think I should be able to get your code to run on this board ?
Or are their significant differences between the F334 and the F373
I've not looked at the spec, and they seem quite similar but the 334 has less ram (I can't see that would be an issue)
Is it worth giving it a go, or can you think of a reason why its not likely to work if I select the F373 board (as I can worry about ram overflow myself ;-)
Edit. I can manually upload the bin file using the STLink program from ST
I notice that you've got a dfu-util binary blob in the repository without source. But dfu-util is GPL. :-(
Avik,
There's been a lot of fun tying down specs for what's becoming commonly known as the Black F407VET6 board across the various STM32 Arduino cores - the Maple-based one that Roger has been looking after, the new STM32DUINO (Freceric Pillon) and DanielEff's GenericSTM32.
While I've successfully tested many functions with koduino, there are a few port assignments mandated by onboard hardware.
I'd like to generate a variant for koduino and have already made some solid progress.
A few questions:
Are you open to specific board variants - only different in pin configs? I get the feel that your main focus for now is on chip-level variations.
Have you done away with Arduino-style pin numbering altogether? (That is being able to use something that equates to a board header pin as well as the PortPin notation) Variant_codegen.py seems to always output data in alpha-numeric order, no matter what order the data is in. Maybe I've missed something in the pin_map.csv file layout.
Thanks in anticipation.
Richard
Hi,
Really nice what you have done here. I especially like that you've based this on CMSIS which really reduces the effort to use various STM32 devices. I've be using Roger Clarks STM32Duino for f103 parts with a few of my own modifications which is based on Maple libraries. He's done a fine job and it works quite well but because of the nature of the Maple code it's not easy to modify and doesn't benefit from CMSIS. I assume it's a benefit but I'd like to find out by getting f103 working in koduino, porting some of my STMDuino code, and comparing the results - particularly on interrupt performance. Can you give me a quick rundown of what's required to finish up the f103 support to save me some time?
Thx,
Ron Curry
The installation instructions are a bit vague, but was able to pursue it a bit. 1) on Win10 (at least) i could not get anything to even start to work. The first problem I encountered was the need for Python. I got a message which indicates that python was missing on my install. It is not clear if it is 2.7 or 3.6, so I installed 2.7 as it is 'most stable'. The installations say nothing about Python, but apparently it is needed to upload code using the serial bootloader (Also no idea if this is correct, but it was the default selection). Also after python is installed, you need to install the serial library.
The second problem is that for whatever reason, the koduino package cannot go in C:\Users\username\Documents\Arduino\hardware. When I tried to compile the blink script using the 'serial stm32 loader' , I get an error: python: can't open file 'C:\Program Files (x86)\Arduino/hardware/koduino/stm32/system/stm32loader.py': [Errno 2] No such file or directory
. Somewhere it appears to be hard coded to the C:\Program Files (x86)\Arduino\hardware directory. So I moved the koduino directory and tried again. Now I get this
File "C:\Program Files (x86)\Arduino/hardware/koduino/stm32/system/stm32loader.py", line 571, in <module>
cmd.open(conf['port'], conf['baud'])
File "C:\Program Files (x86)\Arduino/hardware/koduino/stm32/system/stm32loader.py", line 78, in open
self.sp = serial.Serial(
AttributeError: 'module' object has no attribute 'Serial'
AttributeError: 'module' object has no attribute 'Serial'
Did a bit of googling on how the python script calls the serial library, but cannot go any further. Would love to try this out on my discovery board.
Hi Avik.
I want to use the USB port as a serial one without the need of USB to serial conversion chip like CP2012, just like maple and stm32duino bootloader.
I think the SerialUSB class does that job.
But you mentioned that it is not supported yet.
I wonder if you have a plan to complete the implementation of that library.
Thank you.
Hi,
I've just noticed your repo, and thought you may be interested in our repo which does Arduino for STM32F103
See https://github.com/rogerclarkmelbourne/Arduino_STM32
Cheers
Roger Clark
I made a breakout board using a universal PCB but failed to make external clock work.
The blink example can be uploaded using bootloader(UART1) but blinking period is 9 times longer than expected.(same with and without 8MHz or 16MHz crystal)
So I want to make a PCB and wonder if any standard hardware or reference design exists.
It would be great if I quick-start Koduino just like Arduino.
Also in installation guide and board.txt, the HSE is set 16MHz while system_stm32f37x.c seems to be generated for 8MHz. (I am not sure, I am just a beginner) It would be appreciated if you can check this out.
Thank you.
Hi Avik,
excellent job on these libraries ! Thank you so much for all the hard work !
I have a question regarding multiple sources, when using the makefile approach.
So I have my sketch, and another part of my code, wich I place in a separate
.c file. It appears as the Makefile tries to compile each .c file as a sketch, e.g.
it does not use -o option on the additional files.
Is there a way around it ? Am I doing something wrong ?
Also, what is the best way to reference 3rd party libraries that I installed in Arduino
tree ?
Lastly, I have made some changes to support 'f407 devices. What's the best way
to submit those ? I would like to send them to you for review and then you can
chose if you want to include them or not. What do you think ?
Many Thanks,
rudi
This sketch
#include <EEPROM.h>
void debug() {
Serial1 << millis() << "\t";
for (int i=0; i<10; ++i)
Serial1 << EEPROM.read(i) << "\t";
Serial1 << "\n";
}
void setup() {
Serial1.begin(115200);
attachTimerInterrupt(0, debug, 10);
}
void loop() {
for (int i=9; i>=0; --i)
EEPROM.write(i, i);
delay(1000);
for (int i=9; i>=0; --i)
EEPROM.write(i, 0);
delay(1000);
}
works for about 50 seconds (overwrites) and then cannot change the value any more. I think we'd have to implement a smarter write that would cache and erase the page (sector on F4) if we want to be able to overwrite further. I don't think (to be checked) that the ST EEPROM emulation code EE_Write erases pages or sectors, so we'd need to add code that checks, caches existing data, erases the page, and then replaces the values.
See also: http://stackoverflow.com/questions/30774717/very-few-write-cycles-in-stm32f4
I chose to precompile the SPL for each series (in stm32/system/). However, when compiling those, the HSE_VALUE must be correctly specified otherwise the RCC functions don't work properly. Obviously this is problematic because different variants may use a different oscillator / clock.
Suggestion: precompiled SPL should be in each variant instead of in system/
Avik
I just thought you may like to know that STM have contacted me and they have developed their own Arduino core for STM32
It is based on the HAL files from the STM32CubeMx to technically it will support F3 (and F4)
My understanding is that they will release a beta later this week, and I've added them as members to the stm32duino github "organization", so the repo will initially be in that account
I have not see the code yet, so I can't give any more details, but I'll keep you posted.
BTW.
Initial release will be F103 L4 F4 and some others possibly L1 (To Be Confirmed)
On chips with a smaller number of timers, taking up a timer seems wasteful for each timer. Obviously this depends on if basic timers are available (only UPDATE event, no capture/compare channels), or a general purpose timer is available. In the latter case, the frequency range attainable will be limited.
Hi.
I am trying to apply Koduino to my custom made board based on STM32F373CCT6.
What I have tested is,
void setup()
{
Serial1.begin(115200);
delay(1000);
Serial1 << "Start" << endl;
}
void loop()
{
Serial1 << "Test" << endl;
delay(1000);
}
The problems are:
I wonder if you have any idea about these.
Thank you.
There are a couple of reasons it could but they are pathological. Need to debug which occurs more frequently
I working on a variant for the STM32F407-Discovery board. I noticed that in SPI.cpp, line 82, there is a comment for a Steensy default? Although "Google is my friend", she let me down on a search for Steensy. Perhaps you are trying to support Teensy 3.x, a Freescale board?
Either way, I managed to get the SPI working with the onboard accelerometer after a bit of work using the setPins(...) method.
I've forked your repo and you are more than welcome to take a look and comment.
This would be useful for the brushless boards, where the current sensing should be synchronized with the PWM. Here are some helpful links:
http://survivalengineer.blogspot.com/2013/03/stm32f4-and-most-of-what-you-ever.html
Hi Avik
You probably have not noticed, but Arduino 1.6.2 made a major change, and the ARM compiler is not installed by default, you need to go to the new Boards Manager under Tools->Boards and install the Due to get it to install the ARM compiler
But even when you do that, the repo won't work because they have moved where the compiler located :-(
You could change you platforms.txt to match, the new location, but you will need to add a read me to give instructions about installing the Due
But basically the board manager is the new method to install boards, but currently it only supports downloading the boards package data from here
http://downloads.arduino.cc/packages/package_index.json
See my issue about adding other third party boards via the Boards manager arduino/Arduino#2856
Wish to make a blue-pill like dev board, but feeling lost as I failed to find any maple-like bootloader for STM32F303CCT6 that can be uploaded via serial. Requesting your assistance/guidance to make such dev-board..
Please guide me to suitable Arduino Core repo for 303CC and most importantly, maple-like bootloader (if any)
Regards.
I am wondering if anybody knows what changes, if any, need to be made to the f303v's hse_8.inc to make it work on the f303c? When I use it without any changes, HSE startup times out. This could be due to a hardware problem on my board (which is a blue pill with the MCU swapped out), but before I solder in a new crystal, I'd like to see if maybe there is something wrong on the software side.
Setting the LED on GPIO_Pin_9 to HIGH and LOW should blink one user LED but it doesn't.
I can upload other ELF/BIN programs on this board just fine, using df-util and stlink just fine, and using the Arduino 1.61 IDE shows that the binary is uploaded OK. I also manually uploaded the binary with the same result (no blinking LED).
Could you test it on a STM32F303 Discovery board?
Thanks!
#include <Arduino.h>
const int led = GPIO_Pin_9;
void setup() {
pinMode(led, OUTPUT);
digitalWrite(led, HIGH);
delay(1000);
digitalWrite(led, LOW);
delay(1000);
}
void loop() {
}
Question from email:
Did the Koduino Timer interrupts support complementary output for PWM ouput pins with dead time?
Need to implement and test this. First candidate will probably be F373 (have some old boards lying around with USB connected). Not sure what VID/PID should be used?
I notice in one of your commits 64f6560 that you mention that F4 works but not the libraries
Can you commit the boards.txt that has the F4 board in it?
As I'd like to test on my Discover 407VGT
Need some Makefile wizardry to fix this
Hi,
Is there a way to make Koduino work on Arduino IDE 1.6.9? It does compile the code, but this is the error I get when trying to upload:
`Warning: platform.txt from core 'Koduino STM32 Boards' contains deprecated compiler.path={runtime.ide.path}/hardware/tools/gcc-arm-none-eabi-4.8.3-2014q1/bin/, automatically converted to compiler.path={runtime.tools.arm-none-eabi-gcc.path}/bin/. Consider upgrading this core.
Warning: platform.txt from core 'Koduino STM32 Boards' contains deprecated recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} {compiler.ar.extra_flags} "{build.path}/{archive_file}" "{object_file}", automatically converted to recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} {compiler.ar.extra_flags} "{archive_file_path}" "{object_file}". Consider upgrading this core.
Sketch uses 23,604 bytes (36%) of program storage space. Maximum is 65,536 bytes.
java.io.IOException: Cannot run program "C:\Program Files (x86)\Arduino/hardware/koduino/stm32/system/stm32ld/stm32ld.exe": CreateProcess error=2, O sistema não pode encontrar o arquivo especificado
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
at processing.app.helpers.ProcessUtils.exec(ProcessUtils.java:26)
at cc.arduino.packages.Uploader.executeUploadCommand(Uploader.java:130)
at cc.arduino.packages.uploaders.SerialUploader.uploadUsingPreferences(SerialUploader.java:209)
at cc.arduino.UploaderUtils.upload(UploaderUtils.java:78)
at processing.app.Sketch.upload(Sketch.java:1186)
at processing.app.Sketch.exportApplet(Sketch.java:1160)
at processing.app.Sketch.exportApplet(Sketch.java:1132)
at processing.app.Editor$DefaultExportHandler.run(Editor.java:2409)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.io.IOException: CreateProcess error=2, O sistema não pode encontrar o arquivo especificado
at java.lang.ProcessImpl.create(Native Method)
at java.lang.ProcessImpl.(ProcessImpl.java:386)
at java.lang.ProcessImpl.start(ProcessImpl.java:137)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
... 9 more
Invalid library found in D:\Arduino\hardware\koduino\stm32\libraries\SDADC_: D:\Arduino\hardware\koduino\stm32\libraries\SDADC_
Invalid library found in D:\Arduino\hardware\koduino\stm32\libraries\SDADC_: D:\Arduino\hardware\koduino\stm32\libraries\SDADC_`
And also, there is no port shown at the Port menu.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.