fpistm / arduino_core_stm32f1 Goto Github PK
View Code? Open in Web Editor NEW[Deprecated] STM32F1 support added to the Arduino_Core_STM32.
[Deprecated] STM32F1 support added to the Arduino_Core_STM32.
Pin usage for I2C is hard coded in twi.c
As the Nucleo uses remapped pins for I2C the initialisation for this should be in somewhere in the variant folder (possibly variant.cpp) so that it can be configure on a per board basis
Steps to reproduce
Install original version from boards manager package
Load example sketch Analog->Fading
change ledPin from 9 to 13
Upload
On Nucleo F103RB this seems to just flash the LED and not fade it, I checked with a logic analyser and it does not appear to deliver PWM on that pin
I tired on a different board on a different pin and got the same result
Functions like portOutputRegister are missing and should be added to variant.h (to follow what Arduino do for their boards)
Initially I thought we needed a different lib for the bootloader and non bootloader version for the Blue Pill etc, but this is not correct as VECT TAB OFFSET is included as part of the IDE Build process.
The confusion is because VECT_TAB_OFFSET is explicitly declared in the library make files but has no effect.
I think the makefile should be updated to remove this, to avoid confusion
Generally works fine on my Maple Mini. Thanks ;-)
Nice to see the Cube files in action and tiny variant folders!
I needed to change
{runtime.tools.STM32Tools.path}
to
{runtime.hardware.path}
in
platform.txt
to get the DFU bootloader to work (java can't find file error on attempted upload).
runtime.tools.STM32Tools.path doesn't appear to be defined. (Maybe my config issue, but others might have similar setups.)
Arduino 1.6.12
New Cube STM32F1 files placed in C:\Program Files (x86)\Arduino\hardware\STM32\ alongside all my working "Maple style" STM32duino files with a common \tools and \drivers folders.
The build error looks like its caused by the inclusion of the USB files.
Error while compiling Nucleo F103RB
core.a(hw_config.c.o): In function `USB_LP_CAN1_RX0_IRQHandler':
D:\Documents\Arduino\hardware\stm32_official\STM32F1\cores\arduino\libstm32f1/hw_config.c:237: undefined reference to `hpcd_USB_FS'
D:\Documents\Arduino\hardware\stm32_official\STM32F1\cores\arduino\libstm32f1/hw_config.c:237: undefined reference to `HAL_PCD_IRQHandler'
It looks like this has something to do with the USB which is not connected on the Nucleo and hence is probably not getting compiled into the static lib for the Nucleo
Inside libstm32f103c hw_config.c SystemClock_Config() the HSEPredivValue is not initialized:
RCC_OscInitStruct.HSEPredivValue = RCC_HSE_PREDIV_DIV1
;
The BluePill board does not have pin numbers written on the board, use pin names in its variant.cpp:
extern const PinDescription g_APinDescription[]=
{
{ PA0, GPIO_PIN_0, GPIOA, ...
{ PA1, GPIO_PIN_1, GPIOA, ...
{ PA2, GPIO_PIN_2, GPIOA, ...
...
Files like libstm32f1_nucleo-f103rb_gcc_rel.a.txt are not really needed.
I've commented out the line which generates them in stm32f103c.mk
If everyone agrees they are not necessary, I'll delete them as well from git etc
Code to get port and in seems time consuming and overly complex.
//find the pin.
for(i = 0; i < NB_PIN_DESCRIPTIONS; i++) {
if(g_APinDescription[i].arduino_id == ulPin) {
g_digPinConfigured[ulPin] = g_APinDescription[i];
g_digPinConfigured[ulPin].configured = true;
break;
}
}
Simple array lookup would probably suffice
I think RAM us can be reduced in a number of places - not just the g_analog_config
''typedef struct _PinDescription
{
uint32_t arduino_id;
uint32_t ulPin ;
GPIO_TypeDef * ulPort;
uint32_t mode;
bool configured;
} PinDescription ;''
Seems wasteful as arduino_id would fit in uint8_t, pin would definitely fit in uint8_t
mode would fit in uint16_t
I don't know what size bool could convert to, but its going to take more than 1 bit, so the compiler may decide to make that a uint32_t (I'd need to check if this was worth changing to uint8_t to guarantee lowest memory usage)
In fact the pinDescription struct is used in both const and non const arrays.
Looking at
PinDescription g_intPinConfigured[MAX_DIGITAL_IOS];
The only part of this array that gets updated is the .configured
g_intPinConfigured[pin].ulPort
and
g_intPinConfigured[pin].pin
are read, but never written
So it would be more efficient to have another struct for the Interrupt in descriptors like
typedef struct _IntPinDescription
{
PinDescription *pinData;
bool configured;
} IntPinDescription ;
and instead of
g_intPinConfigured[pin] = g_APinDescription[i];
use
g_intPinConfigured[pin].pinData = &g_APinDescription[i];
(I'm not sure if that would compile, you you get the idea ;-)
Following the merge of the branch of danieleff, the Wire library doesn't compile. The header twi.h is not found.
Only tested with the Nucleo variant.
running
make clean
does not work correctly, it returns errors and
make clean
------------------------------------------------------------------------
--- Cleaning lib release and debug
------------------------------------------------------------------------
--- Cleaning __NUCLEO_F103RB__ files release_nucleo-f103rb ../../../variants/STM32F103RB-Nucleo/libstm32f1_nucleo-f103rb_gcc_rel.a
make[1]: [clean] Error 127 (ignored)
make[1]: [clean] Error 127 (ignored)
make[1]: [clean] Error 127 (ignored)
math lib is omitted when linking on the F1 core but not the F4 core.
commenting out the line in platform.txt and replacing it with this one, from the F4 core seems to fix it:
recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" -mcpu={build.mcu} -mthumb {compiler.c.elf.flags} "-T{build.variant.path}/{build.ldscript}" "-Wl,-Map,{build.path}/{build.project_name}.map" {compiler.c.elf.extra_flags} -o "{build.path}/{build.project_name}.elf" "-L{build.path}" -Wl,--start-group "{build.path}/core/syscalls_stm32.c.o" {object_files} "{build.variant.path}/{build.variant_system_lib}" "{build.path}/{archive_file}" -Wl,--end-group -lm -gcc --specs=nano.specs
Hi,
i founded this solution:
http://www.stm32duino.com/viewtopic.php?t=678
nvic_sys_reset();
but this function is not included.
Do i have another possibility to reset my board within software?
Error in Makefile: make clean do not delete the library in Nucleo variant folder.
HAL_RCC_GetSysClockFreq() returns 64000000
Files null or nul without extensions are hard or impossible to delete on Windows.
I had to boot into linux to remove them from my hard drive
The file incorrectly lists the MCU type and has incorrect FLASH and RAM sizes
When using MCP342x library, a compilation issue is raised:
Arduino15\packages\STM32\hardware\stm32l4xx\2016.9.16\libraries\Wire/Wire.h:51:5: error: 'i2c_instance_e' does not name a type
i2c_instance_e p_i2c_instance;
^
To correct this, #include "twi.h" should be made in the wire.h instead of wire.cpp.
https://github.com/stm32duino/Arduino_Core_STM32F1/blob/master/cores/arduino/libstm32f1/analog.h#L71
is not correct for F103C as its only got 10 channels
This probably needs ifdef's around it to set the value based on MCU series and version.
However
https://github.com/stm32duino/Arduino_Core_STM32F1/blob/master/cores/arduino/libstm32f1/analog.c#L105 would also need to be changed as it defines all 16
I think the optimal solution may be to use if defined(...) in analog.c, so that only the applicable ADC channels for a specific MCU device are included in the array
HAL callback functions in the core should should be declared as weak so they can be overridden in the sketch
@stevstrong noticed that the number of USB end points is quite high (16) and can probably be reduce if we are just using the serial driver
However at the moment I'm trying to limit the number of changes to the HAL files, because if we want to update to a newer version of the HAL in the future any changes to those files would need to be re-applied
Issue related to the following post: http://stm32duino.com/viewtopic.php?f=48&t=2127
Linked with #46
In original Arduino analogRead treats pin A0 (= 14) as 0.
The current code does that in wiring_analog.c pinConvert(), that converts pins A0 (= 16) to 0 etc...
This conversion is only needed in Nucleo variant to emulate the arduino board, and will cause confusion in other boards. In bluepill calling analogRead(PA0) will try to read pin PA0 | A0 => PB0
One way is to make ARDUINO_PIN_A0 = 0 in other variants, which is confusing.
Other is to pinConvert to variant.cpp, and just return ulPin in non nucleo boards.
Hello,
in my project i need SERIAL_8E1 setting , but there is no begin function with two parameters available:
Serial1.begin(19200, SERIAL_8E1)
This settings are internaly availible:
https://github.com/stm32duino/Arduino_Core_STM32F1/blob/master/cores/arduino/libstm32f1/uart.c#L327
Can you please add it in Arduino style?
Hi,
i'm confused about 8bit PWM resolution...
https://github.com/stm32duino/Arduino_Core_STM32F1/blob/master/variants/STM32F103C_BluePill/variant.h#L143
Is there a reason for it? or can i make a PR to increase it to 16bit?
Why is PWM supported only on few pins? (PA7,PB3,PB4,PB6,PB10)?
PWM can be used on at least 12 pins...
https://github.com/stm32duino/Arduino_Core_STM32F1/blob/master/variants/STM32F103C_BluePill/variant.cpp#L39
There are only A0-A3 available. But PA2,PA3,PA5,PA6,PA7,PB1 can also be used for ADC.
Similar issue: #26
It would be nice to have support for other variants. I think the BluePill would be a good one to try at first.
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.