Git Product home page Git Product logo

arduino_core_stm32f1's Introduction

Hi there ๐Ÿ‘‹

zephyr-technical-contributor

๐Ÿ“ˆ GitHub Stats

fpistm's GitHub Stats

arduino_core_stm32f1's People

Stargazers

 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

arduino_core_stm32f1's Issues

analogWrite should work on more pins on some variants

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

We need different static libs for the Blue Pill, with bootloader and without bootloader

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

Tools (win) folder possibly wrong in platform.txt

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.

Latest version - merge from @danieleff has compile error on Nucleo F103RB

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

Convoluted code to get port and pin from pin number

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

There is scope to reduce the RAM requirement by various changes

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 ;-)

Compilation error with Wire library

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.

Make clean when creating the libstm32f1 library has errors

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)

linker omits math lib

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

Compilation issues when including wire.h

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.

define NB_ANALOG_CHANNELS 15 in analog.h is not correct for all F1 devices

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

Number of USB endpoints may be reduced

@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

https://github.com/stm32duino/Arduino_Core_STM32F1/tree/master/system/Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pcd.h#L121

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

analogRead(pin) overrides the pin it is given

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.

Serial3 not found ?

I have a BluePhill board STM32F103C8t6.
I can't use UART3 when i tried to use this Core.
deepinscreenshot20170523110150

Actually, on STM32CubeMX i found the USART3. Check this..
deepinscreenshot20170523110215

PWM resolution and other pin related settings

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.

grafik

Similar issue: #26

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.