Giter Club home page Giter Club logo

koduino's Introduction

Documentation Status

Koduino

This is a library of code for boards developed using the STM32 F3/F4 microcontrollers, chosen for their great price/performance ratio, friendly built-in bootloaders, and (for the Cortex-M4F ones) FPU support.

Supported hardware

  • Upload methods: Serial (incl using USB-Serial adapters), ST-Link V2
  • Chip families: F301, F373, F405

Supported software

  • 95% of the Arduino core (felt no urgency to implement shiftOut or tone but they should be easy)
  • Libraries: Wire, SPI, EEPROM, Encoder, etc.
  • Important: Serialx (USART) is supported well, but SerialUSB (using USB CDC) is not supported yet--coming soon.
  • Documentation!

Why does this library exist?

Roger Clark compiled a list of other STM32 Arduino compatibility projects. I really began working on this because my initial F373-based hardware was not supported by any of them. Even so, I think this library may have some of the folowing benefits for others as well.

As a user

  1. Works with the Arduino IDE
  2. Awesome features that are not in Arduino: e.g.
    1. Hardware floating point, and advanced math libraries (Eigen is included)
    2. Non-blocking PWM input--use PWM as a fast, simple communication method
    3. Fast SD-card writing using SDIO
    4. Timer interrupts (run code with precise timing up to several MHz)
    5. ...
  3. Hands-free programming on boards with hardware support (FTDI chip with NRST/BOOT0 connections)
  4. Wireless programming on boards with hardware support (wireless-UART like XBee)
  5. Already in use in my several of my own critical projects, including
    1. "Flight control" boards with EKF orientation filtering, motor control and data logging @ 2 KHz
    2. Field-oriented brushless commutation @ 25 KHz

As a developer

  1. Porting to new chips: This process is much easier than with libmaple, or Aeroquad32, etc. because this library uses a (relatively) portable interface layer, the ST standard periperal library, to try and use the same Arduino core code to interface with several microcontrollers. The alternative, to begin with the register map for each new chip, is tedious at best (trust me, I tried ;) ).
  2. Open-source hardware: No custom bootloaders are required. You can literally make your own board from one of the reference designs (repo coming soon), or even begin straight from the microcontroller datasheet reference schematic, and get your own hardware working quickly.

Get started

1. Get code from this repository

If you're used to mercurial, git should be no problem. You can

  • Download the repository as a zip file, or
  • Clone it by typing git clone https://github.com/avikde/koduino.git at the location you want.

2. Program microcontrollers

Links to get started are at http://avikde.me/koduino.

Contribute

If this library is helpful to you, please consider contributing to it. The main areas that need help are:

  • Adding support for more chips
  • Maintaining upload tools for several OS'es / platforms, debugging wireless uploads, making uploads faster, etc.
  • Contributing to the Arduino core: I often leave out functionality that I don't need (e.g. tone) but someone might!

You are welcome to fork, and please submit pull requests if you do! Additionally, I would love to have direct collaborators who have commit access--don't hesitate to get it touch.

koduino's People

Contributors

avikde avatar gavinrobot avatar gwenger avatar jduperret avatar turnert23 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

koduino's Issues

FYI. STM will release a Arduino STM core

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

https://github.com/stm32duino

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)

Serial Bootloader for STM32F303CCT6 and compatibility with Arduino

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.

Creating new variant: HSE_VALUE needs to be correct when compiling new SPL .lib files

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/

F303C HSE

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.

Multiple Source with Makefile

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

New board, same chip

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:

  1. 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.

  2. 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

SPI Bus and STM32F4

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.

  1. I would like to send you a pull request later this week/next week for this variant. I've tentatively named it "F407_Discovery".
  2. I would like to change default for SPI1 MISO to PA6
  3. Maybe some other changes to the F4 core to more closely match the Discovery board.

I've forked your repo and you are more than welcome to take a look and comment.

Nucleo STM32F334

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

Cannot get to run on Windows 10

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.

LED doesn't blink on STM32F303 Discovery

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() {  
}

Any standard hardware to start with?

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.

Complementary output PWM

Question from email:

Did the Koduino Timer interrupts support complementary output for PWM ouput pins with dead time?

STM32F4 Discovery board on Arduino IDE 1.6.9

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.

stm32f103 support

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

dfu-util license

I notice that you've got a dfu-util binary blob in the repository without source. But dfu-util is GPL. :-(

F4 support ?

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

EEPROM write fails after ~50 overwrites

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

Problem with UART.

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:

  • the baudrate in serial monitor should be set to 57600(half the value set by Serial1.begin(). I tried a couple of other baudrate and results are same(always half the set value)
  • the Seiral1 in setup() doesn't work without delay() function, and with delay(<1000). It works with delay(>= 1000). I tried delay time 100, 900, 990 and no use. It seems that the number 1000 is a magic number...

I wonder if you have any idea about these.
Thank you.

Use fewer timers for attachTimerInterrupt

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.

You repo will not work with Arduino 1.6.2 - nor does mine :-(

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

SerialUSB class

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.

SerialUSB functionality

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?

Synchronized analogRead with PWM timing

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.