rogerclarkmelbourne / arduino_stm32 Goto Github PK
View Code? Open in Web Editor NEWArduino STM32. Hardware files to support STM32 boards, on Arduino IDE 1.8.x including LeafLabs Maple and other generic STM32F103 boards
License: Other
Arduino STM32. Hardware files to support STM32 boards, on Arduino IDE 1.8.x including LeafLabs Maple and other generic STM32F103 boards
License: Other
Include "EEPROM.h" into ino project, throw the error when compile:
.../flash_stm32.c:3:19: fatal error: flash.h: No such file or directory
#include "flash.h"
This is just a note, that I added digitalPinToBitMask() to variant.h as it is required by some libraries
However whether it will be possible to implement this in a way that is compatible with all libraries is yet unclear.
I just added the file, so that libraries that use it would require less modification. But all the libraries that I have seen that use this e.g. OneWire, have a lot of #ifdef'ed blocks of code for various architecture dependent macros, so the libraries would need significant modification to work.
Ultimately the issue is that the Arduino IDE / API environment does not have a good solution to platform specific build requirements.
The main causes of the platform specific code inside the #ifdef's seems to be because digitalWrite and digitalRead etc are not very fast.
When using the Maple USB Serial connection, peek() works OK for the first packet of data, however when a second packet of data, i.e one or more characters is sent.
The entire USB driver appears to crash, and even locks up the Arduino IDE if the COM port window is open.
Note. This bug only applies to USB Serial, but Hardware Serial.
May can you create a json file for the 1.6.4 Board Manager ?
Thanks
microduino board identifier is nano
. There is no issue with Arduino IDE, but nano
name is shared with Arduino Nano board.
Month ago I released cuwire โ IDE for microcontrollers, based on Arduino 1.5 hardware specification. And command line tool can assume board vendor (like arduino
or Arduino_STM32
) by board name. After installation of STM32 files nano
shortcut of board name is not working anymore.
Please change nano
to microduino
. I can make pull request for that change, but want to discuss before. Probably you have a good reason to name microduino
as nano
Hi, was wondering according to this page
it says all 4 hardware serial ports are available?
So which hardware do select to compile for to not get an compile error for serial 4?
Thanks,
Sky
The Arduino IDE made some major changes to the IDE file structure in version 1.6.2 which cause it to not work with this repo
At the moment I suggest that everyone stay with 1.6.1 as this is known to work.
The reason is that the IDE team have completely restructured the files that are installed, to make it modular, and 1.6.2 no longer installs the Due board and hence no longer installs the ARM compiler by default
It is possible to "Install" the Due and to get the ARM compiler, but the ARM compiler is installed in a completely different directory, hence the path specified for the compiler in platforms.txt is no longer correct.
There is a work around for this. However if I change platform.txt it breaks the repo for all previous versions :-(
I'm trying get the Arduino IDE team to add a feature so that third party boards can be added by the Boards Manager feature.
So watch this space...
The layout you suggest for installation is incorrect. It WAS correct for the older versions of Arduino. 1.6 and beyond lays things out in a much better way.
Here is how I did the installation:
under the hardware dir, made an 'ST' dir, and copied the STM* dirs under that.
Made an 'ST' dir under the root examples directory, and copied the examples there.
copied the Linux maple tools where they belong, under hardware/tools
Adjustments still need to be made to the recipes for uploading in order to work still, but this is a start.
If you like I can fork and re-arrange everything where it aught to go, and I also can include support for the STM32f429-discovery board as well.
https://github.com/texane/stlink should be used on Linux for uploading via the stlink interface.
While I realize you are basing this off of the work done on maples, I'm a bit disappointed that you didn't just use CMSIS headers in order to define everything. Arduino does exactly this for the Atmel ARM chips. It would have made everything so much easier.
http://www.stm32duino.com/viewtopic.php?f=35&t=27&p=130#p119 This is one seems to work for the stm32f103c8 .. still need one for the CB version
Hi,
Would be nice to be able to upload code to RAM. Any plans to put that in too?
(and thanks! works great)
There are various compile errors.
I added missing functions to SPIClass for attachInterrupt and detachInterrupt() but the library is using the old HardwareSPI class, which is still in the codebase.
Also the library uses the yield() function which won't link at the moment
The library will need to be changed to use SPIClass instead of HardwareSPI
I think our best option is to put a copy of the class in the libraries folder and modify it so it works for STM32, then hope we can get the custodians of the library to incorporate our changes at a later date
I looked in "Wire.h" to find what pins the I2C bus would show up on. Found definitions for SCL and SDA but... nothing! Turns out there is a
//TwoWire Wire(SCL, SDA, SOFT_STANDARD);
TwoWire Wire(PB6, PB7, SOFT_STANDARD);
at the bottom of Wire.cpp which ignores the definitions of SCL and SDA.
I'm using Arduino 1.6.5 as a command line compiler for a Nucleo project. I noticed that quite a lot of warnings are thrown to stdout (or stderr) when running Arduino from a command line window:
Picked up JAVA_TOOL_OPTIONS:
Loading configuration...
Initializing packages...
Could not find boards.txt in /home/ctack/Programs/arduino-1.6.5/hardware/Arduino_STM32/examples. Is it pre-1.5?
Board Arduino_STM32:STM32F3:discovery_f3 doesn't define a 'build.board' preference. Auto-set to: STM32F3_DISCOVERY_F3
Warning: platform.txt from core 'STM32F3 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.
Could not find boards.txt in /home/ctack/Programs/arduino-1.6.5/hardware/Arduino_STM32/drivers. Is it pre-1.5?
Warning: platform.txt from core 'STM32 Boards (STM32duino.com)' 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.
Board Arduino_STM32:STM32F4:discovery_f407 doesn't define a 'build.board' preference. Auto-set to: STM32F4_DISCOVERY_F407
Board Arduino_STM32:STM32F4:stm32f4stamp doesn't define a 'build.board' preference. Auto-set to: STM32F4_STM32F4STAMP
Board Arduino_STM32:STM32F4:netduino2plus doesn't define a 'build.board' preference. Auto-set to: STM32F4_NETDUINO2PLUS
Warning: platform.txt from core 'STM32F4 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.
Could not find boards.txt in /home/ctack/Programs/arduino-1.6.5/hardware/Arduino_STM32/tools. Is it pre-1.5?
Preparing boards...
Verifying...
To make things clear: building projects for the Nucleo works just fine with Arduino_STM32 and Arduino, except for the above errors being thrown.
This example doesn't work because the return from Wire.endTransmission() always returns SUCCESS
This is not the same as the current Arduino 1.0 + API of this function.
Hi,
i tried to follow installation instructions for Linux, i installed the Arduino_STM32
under the ~/Arduino/hardware
directory and it seems to work (i don't tried the upload yet), but anytime when i open the Board manager, i get these messages in Arduino's debug window:
Could not find boards.txt in /home/XXXX/Arduino/hardware/Arduino_STM32/tools. Is it pre-1.5?
Could not find boards.txt in /home/XXXX/Arduino/hardware/Arduino_STM32/drivers. Is it pre-1.5?
Warning: platform.txt from core 'STM32 Boards (STM32duino.com)' 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.
Board Arduino_STM32:STM32F3:discovery_f3 doesn't define a 'build.board' preference. Auto-set to: STM32F3_DISCOVERY_F3
Warning: platform.txt from core 'STM32F3 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.
Board Arduino_STM32:STM32F4:discovery_f407 doesn't define a 'build.board' preference. Auto-set to: STM32F4_DISCOVERY_F407
Board Arduino_STM32:STM32F4:stm32f4stamp doesn't define a 'build.board' preference. Auto-set to: STM32F4_STM32F4STAMP
Board Arduino_STM32:STM32F4:netduino2plus doesn't define a 'build.board' preference. Auto-set to: STM32F4_NETDUINO2PLUS
Warning: platform.txt from core 'STM32F4 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.
Could not find boards.txt in /home/XXXX/Arduino/hardware/Arduino_STM32/examples. Is it pre-1.5?
Could not find boards.txt in /home/XXXX/Arduino/hardware/Arduino_STM32/tools. Is it pre-1.5?
Could not find boards.txt in /home/XXXX/Arduino/hardware/Arduino_STM32/drivers. Is it pre-1.5?
Warning: platform.txt from core 'STM32 Boards (STM32duino.com)' 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.
Board Arduino_STM32:STM32F3:discovery_f3 doesn't define a 'build.board' preference. Auto-set to: STM32F3_DISCOVERY_F3
Warning: platform.txt from core 'STM32F3 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.
Board Arduino_STM32:STM32F4:discovery_f407 doesn't define a 'build.board' preference. Auto-set to: STM32F4_DISCOVERY_F407
Board Arduino_STM32:STM32F4:stm32f4stamp doesn't define a 'build.board' preference. Auto-set to: STM32F4_STM32F4STAMP
Board Arduino_STM32:STM32F4:netduino2plus doesn't define a 'build.board' preference. Auto-set to: STM32F4_NETDUINO2PLUS
Warning: platform.txt from core 'STM32F4 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.
Could not find boards.txt in /home/XXXX/Arduino/hardware/Arduino_STM32/examples. Is it pre-1.5?
I don't understand this in depth, but when i take look, i can see, that the Arduino Duo code was installed under ~/.arduino15/packages/arduino/hardware/sam
and the tools are in the ~/.arduino15/packages/arduino/tools
, then IMO some improvements of the location are needed.
BTW: i replaced my account homedir with XXXX
.
I have this board from ebay
http://www.ebay.com/itm/360925962777
The led is on PC13 not PC14. Also, it doesn't have a button.
http://img2.dib-bid.com/gallery3/3/f3/55526/055526-2-03.jpg Visible connection on this pic.
Others might also be having this problem
To do. Implement setClockDivider ;-)
Hello,
is there a way to implement the "upload router" for OSX/(Linux), so mac user can use the generic board?
While uploading we get the problem with the upload_router.bat file :
java.io.IOException: Cannot run program "/Users/madias/Documents/Arduino/hardware/Arduino_STM32/tools/win/upload_router": error=2, No such file or directory
at java.lang.ProcessBuilder.processException(ProcessBuilder.java:478)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:457)
at java.lang.Runtime.exec(Runtime.java:593)
at java.lang.Runtime.exec(Runtime.java:466)
at processing.app.helpers.ProcessUtils.exec(Unknown Source)
at cc.arduino.packages.Uploader.executeUploadCommand(Unknown Source)
Thank you for that great project!
regards
Matthias
See this commit 3f20a38
Hi,
I installed Arduino 1.6.0 and the Arduino_STM32-master files like explained. When compiling programms for Maple Rev 3 to Flash I got the error
arduino-1.6.0/hardware/Arduino_STM32/STM32F1XX/cores/maple/Arduino.h:42:21: fatal error: variant.h: No such file or directory
#include "variant.h"
After copiing the files variant.h and pins_arduino.h from directory
~/arduino-1.6.0/hardware/Arduino_STM32/STM32F1XX/variants/maple_mini to
~/arduino-1.6.0/hardware/Arduino_STM32/STM32F1XX/variants/maple
it compiled without errors.
Regards
Reinhard
See my comment here:
I've noticed that the original leaflabs libmaple repo has some fixes that also need to be manually applied to this repo.
https://github.com/leaflabs/libmaple/commits/master
Long story, but the original code for this repo was copied by BobC from leaflabs/libmaple@f4d4fe2
He made some changes to get it to work with the 1.5.x IDE
I copied his repo when he stopped working on it, and made loads of changes to bring it roughly up to Arduino API 1.0
Which basically means, we don't have the fixes that have been added to the leaflabs repo since
So there are possible fixes for some of the issues you raised
e.g.
However I suspect as the code has changed quite a lot, it will take some detective work to work out the current location of some of the code in question
See my comment
Many libs using pins macros such as Adafruit_ILI9341.
Here is the pins compatibility macros needed.
#define digitalPinToPort(pin)
#define digitalPinToBitMask(pin)
#define portOutputRegister(pin)
#define portSetRegister(pin)
#define portClearRegister(pin)
#define portToggleRegister(pin)
#define portInputRegister(pin)
#define portModeRegister(pin)
#define portConfigRegister(pin)
It seems there is a problem with the serial2, serial3 definitions when chossing "STM32 to Flash - No bootloader"
error: 'Serial3' was not declared in this scope
NOTE.
Any code which uses the Pin compatibility macro's in its constructor - when called globally, e.g. like the OneWire example does.
e.g.
OneWire ds(PA4); // on pin 10 (a 4.7K resistor is necessary)
void setup(void) {
Serial.begin(115200);
}
Will not work.
This is because the PIN_MAP array that contains the data used by the pin compatibility macros. for example
is also effectively constructed at the same time as any global constructors e..g
extern const stm32_pin_info PIN_MAP[BOARD_NR_GPIO_PINS] = {
/* Arduino-like header, right connectors */
PMAP_ROW(GPIOA, 3, NULL, 0, ADC1, 3), /* D0/PA3 */
Hence its impossible to guarantee that PIN_MAP is initialized before other globally initialized items.
I'm looking at the new commits going into the tree and everyone is using different white space settings. Could you document what white space settings should be used?
And then not accept push requests that aren't whitespace clean?
Its been reported that some USB to Serial devices don't work with STM32Flash on OSX
the Errors are
Cannot handle device "/dev/cu.usbserial-A943NTHT"
http://stm32flash.googlecode.com/
Using Parser : Raw BINARY
Failed to open port: /dev/cu.usbserial-A943NTHT
At the moment its unclear what is causing this and the workaround on OSX is to use python in the upload_serial script
python $(dirname $0)/stm32loader.py -e -w -p /dev/"$1" -g -b 115200 "$4"
Currently the fastest speed available on Wire (I2C) is around 250kHZ, as it uses bit-banged rather than hardware I2C transfers.
The speed could easily be improved if the calls to digitalWrite and digitalRead were replaced by direct access to the GPIO, and as this library is device specific, it should not be a crossplatform issue.
However care needs to be taken to ensure support for devices like the STM32F2xx and STM32F4xx as well as the current target (STM32F1xx)
See discussion here: http://www.stm32duino.com/viewtopic.php?f=17&t=87
This code,
int index = 0;
void setup() {
}
void loop() {
}
gives this error
sketch_dec30c.ino:1:5: error: 'int index' redeclared as different kind of symbol
In file included from c:\program files (x86)\arduino\hardware\tools\gcc-arm-none-eabi-4.8.3-2014q1\arm-none-eabi\include\stdlib.h:11:0,
from C:\Users\rclark\Documents\Arduino\hardware\Arduino_STM32\STM32F1XX\cores\maple/wirish.h:41,
from C:\Users\rclark\Documents\Arduino\hardware\Arduino_STM32\STM32F1XX\cores\maple/Arduino.h:30,
from sketch_dec30c.ino:1:
c:\program files (x86)\arduino\hardware\tools\gcc-arm-none-eabi-4.8.3-2014q1\arm-none-eabi\include\string.h:55:8: error: previous declaration of 'char* index(const char*, int)'
char *_EXFUN(index,(const char *, int));
^
Error compiling.
The problem appears to be associated with string.h line 55
char *_EXFUN(index,(const char *, int));
because index is defined as a function like bcopy
However the issue doesn't seem to occur on other boards e.g. the Uno
This is either because string.h is being included incorrectly or possibly because
STRICT_ANSI is not being defined for STM32 but it may be for the Uno etc
I'd like to see the untested stuff moved to a branch by itself. Specifically I'd like to move the STM32F3 and STM32F4 stuff to that branch. I'd like to see the master branch full of known working code. The other branches would still be there but until someone is testing and supporting them they aren't part of the master branch.
What do you think?
missing binaries for stlink (both 32 and 64)
missing binaries for stm32flash ( both 32 and 64)
missing script serial_upload
missing script stlink_upload
Seems like this should be deleted.
Hello,
upload was not possible with dev-util version 0.5 which is in the actual Ubuntu package. After upgrade to version 0.8 upload in perpetual mode works.
Regards
Reinhard
A strange issue seems to have been introduced in commit a3065b0
Where on Maple mini, after upload the code doesnt run, and the serial USB device doesnt re-appear in the windows device manager.
If you physically disconnect and reconnect device I think the program runs but I don't think the serial device appears.
Using the previous commit 1eb90ac seems to work still,
SPI is currently missing at least 2 functions which are in the Arduino 1.0.x API
Specifically setBitOrder() and .setDataMode()
It should not be hard to add them, as the code already sets these paramaters via the SPI internal Settings class
This is a case problem, the following need to include "Stream.h".
hardware/Arduino_STM32/STM32F1XX/cores/maple/HardwareSerial.h
hardware/Arduino_STM32/STM32F1XX/cores/maple/usb_serial.h
See my comments here: 15cdd88#diff-ecec90a9887bbf7499c1aaa57443f26cR196
The platform.txt recipe for linking uses these arguments to bring in the core.a objects:
-Wl,--whole-archive "{build.path}/{archive_file}" -Wl,--no-whole-archive
at line: https://github.com/rogerclarkmelbourne/Arduino_STM32/blob/master/STM32F1/platform.txt#L82
Is there a reason we do this? The linker sucks in the entire core.a file instead of searching and including just the routines it actually uses. This results in a 13k binary for a bare minimum sketch.
If you drop the ld directives and just use:
"{build.path}/{archive_file}"
Then you end up with a more reasonable 3k .elf
Is there a reason to force inclusion of all files in the core.a?
SPI.beginTransaction and endTransaction are currently just hacks to get SPI working.
They are not fully fledged implementations, and still need to be coded.
Hi and thanks for your port of Arduino to STM32f4. I've got it working and was wondering if i2s is available to get the stm32f4 discovery's audio codec working?
Thanks again.
Steve.S
Any chance as I don't have a ST-link?
but have RLINK and a DIY JTAG that works with OPENOCD?
I have a board with RLINK built in.
https://github.com/rogerclarkmelbourne/Arduino_STM32/wiki/Maple-and-Maple-mini
This page says driver signing needs to be disabled, but I don't believe that's necessary anymore.
https://github.com/rogerclarkmelbourne/Arduino_STM32/wiki/Maple-drivers
This page mentions the dwi-simple that I think worked fine without the setting. Using Zadig is also a way to get around the limitation for certain driver libraries.
Using the HardwareTimer class causes a complete crash / halt of the code
You can't even instantiate the class.
e.g.
This modified example from LeafLabs doesn't print anything.
#define LED_RATE 500000 // in microseconds; should give 0.5Hz toggles
// We'll use timer 2
HardwareTimer timer(2);
void setup() {
// Set up the LED to blink
pinMode(PC13, OUTPUT);
// Pause the timer while we're configuring it
timer.pause();
// Set up period
timer.setPeriod(LED_RATE); // in microseconds
// Set up an interrupt on channel 1
timer.setChannel1Mode(TIMER_OUTPUT_COMPARE);
timer.setCompare(TIMER_CH1, 1); // Interrupt 1 count after each update
timer.attachCompare1Interrupt(handler_led);
// Refresh the timer's count, prescale, and overflow
timer.refresh();
// Start the timer counting
timer.resume();
Serial.begin(115200);
}
void loop() {
// Nothing! It's all in the handler_led() interrupt:
Serial.println("HERE");
delay(1000);
}
void handler_led(void) {
digitalWrite(PC13,!digitalRead(PC13));
}
I have examined the patch (line for line) and have come to the conclusion that it is a great enrichment for compatibility reasons and improvement
some examples:
include the "variants.h" into Arduino.h
include <wirish_constants.h> into wirish.h
adds some constants and typedefs (typedef uint32_t uint32;)
a complete overhaul for the SPI class, SPI now works as it should.
the macro 'always_inline' is defined in both the libmaple and also in the gcc headers. The problem is that they don't do the same thing. gcc doesn't include the inline keyword it is just the __attribute part.
Two fixes.
o change all the code in libmaple to add a an inline keyword to precede any __always_inline macro usage
or
o rename the macro so people don't aren't confused if they are used to using the one from gcc
I'd opt for the second solution as the libmaple is different than the gcc
Hello,
I tried to install your arduino STM32 IDE for my Olimex board, but I do not succeed to get the STM32 Board Selection in the Arduino IDE. This is may be I made a mistake where I copy the Arduino_STM32.
I tried to copy it under ~/Arduino/hardware/Arduino_STM3 it is not working
I tried to copy where I download the linux install link :
~/dvpt_tools/arduino/arduino_stm32/arduino-1.6
~/dvpt_tools/arduino/arduino_stm32/arduino-1.6.1$ ls
arduino Arduino_STM32 examples hardware lib libraries reference revisions.txt tools
But still it does not work.
Could you please help to figure out how I can my Linux STM32 Arduino IDE working ?
Thanks
I'm not sure if this worked in BobC's original version, but Maple (i.e Not Maple mini) board types don't seem to compile
Its possible that I have changed something in one of the Maple mini files that needed to be changed in the Maple files, but the error
\usb_core.c.o: In function Standard_SetConfiguration': Arduino_STM32\STM32F1XX\variants\maple\libmaple\usb\usb_lib/usb_core.c:92: warning: undefined reference to
Device_Table'
Looks a bit more serious than could have been caused by any of my changes.
SPI doesn't compile on MicroDuino variant has NSS pin definition is missing from board.h
Ian. I think you will need to put in a work-around by defining NSS to something
Perhaps you can add a pin to the end of the master pinmap for a pin on the STM32 which is not actually connected to the pins on the edge of the board.
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.