Giter VIP home page Giter VIP logo

stm32generic's Introduction

STM32GENERIC

Generic implementation of Arduino for STM32 boards using STM32 HAL. This is an alternative to the Official implementation

Documentation: https://danieleff.github.io/STM32GENERIC/

Installation - Users

TODO create boards manager package

Installation - Developers

  1. Download the latest version from https://github.com/danieleff/STM32GENERIC
  2. Unzip it into [Arduino]/hardware folder
  3. Install Arduino Zero from the board manager for the arm-none-eabi-gcc compiler

Additional instructions for F7 boards:

  1. Download the latest GNU ARM Embedded Toolchain
  2. Change compiler.path in platform.txt to point to that you downloaded.

stm32generic's People

Contributors

caniggia1 avatar danieleff avatar erikiot avatar grafalex82 avatar hanyazou avatar huaweiwx avatar ktand avatar rogerclarkmelbourne avatar serasidis avatar spawn32 avatar victorpv avatar xc0000005 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  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

stm32generic's Issues

Spi compile error for stm32f411re

I've forked the code and intend to fix this because I need to try to use it.

I am running a Nucleo STM32F411RE board. I open the Example SPISelfTest sketch and compile it fine under the BluePill board selection. When attempting to use the F4, it fails with a compile error. The reason for the error I believe is that the STM32F411RE has 5 SPI ports and the SPI.h file only enumerates three of them when building out the SPIx_ChannelTX and SPIx_ChannelRX defines.

`
C:\Program Files (x86)\Arduino\hardware\STM32GENERIC\STM32\libraries\SPI\src\SPI.cpp:81:17: error: 'SPI4_ChannelTX' was not declared in this scope

_ChannelTX = SPI4_ChannelTX;

         ^

C:\Program Files (x86)\Arduino\hardware\STM32GENERIC\STM32\libraries\SPI\src\SPI.cpp:82:17: error: 'SPI4_ChannelRX' was not declared in this scope

_ChannelRX = SPI4_ChannelRX;
C:\Program Files (x86)\Arduino\hardware\STM32GENERIC\STM32\libraries\SPI\src\SPI.h:114:22: note: in expansion of macro '_SPIx_DMA'

#define SPIx_DMA(a) _SPIx_DMA(a)

`

I believe the source of the problem is in this list of defines

#define SPI3_StreamTX 1_Stream5
#define SPI3_StreamRX 1_Stream0
#define SPI3_ChannelTX DMA_CHANNEL_0
#define SPI3_ChannelRX DMA_CHANNEL_0

It stops at 3. It should probably follow the same paradigm as some other code wherein:
#ifdef SPI4 #define SPI4_StreamTX 1_Stream5 #define SPI4_StreamRX 1_Stream0 #define SPI4_ChannelTX DMA_CHANNEL_0 #define SPI4_ChannelRX DMA_CHANNEL_0 #endif #ifdef SPI5 #define SPI5_StreamTX 1_Stream5 #define SPI5_StreamRX 1_Stream0 #define SPI5_ChannelTX DMA_CHANNEL_0 #define SPI5_ChannelRX DMA_CHANNEL_0 #endif

Thoughts?

Cheers,
Mark

Pins not inputs by default?

I'm testing this on two boards, both F4-based. I don't know if this is F4 specific, but I imagine someone else would have run into it if it affected other series as well. It could also be something specific to my setup, but I've accounted for that to the best of my ability.

The boards I'm using are:

  • Discovery F407VG
  • Custom F446VE Board

In both cases, using the latest version of this core for the F407VG and my fork for the F446, I am seeing a problem with the pins when used as inputs.

My understanding is that it's expected the pins will work as either digital or analog inputs by default, without any call to pinMode. The code in the Arduino AnalogRead examples tends to bear this out - there is no call to pinMode in that example, nor in any of the examples included in the STM32Generic core - i.e., the AnalogReadSerial_12bit example:

void setup() {
  // initialize serial communication at 115200 bits per second:
  Serial.begin(115200);

  // configure the ADC for 12 Bits
  analogReadResolution(12);
}

// the loop routine runs over and over again forever:
void loop() {
  // read the input on analog pin 0:
  int sensorValue = analogRead(PA0);
  // print out the value you read:
  Serial.println(sensorValue);
  delay(1);        // delay in between reads for stability
}

If I run that code on either of the boards I have, the results returned seem to have no relation to the actual status of the pin. On both boards, I'm seeing very low analogRead values, < 10. The value seems to have a small amount of noise present (i.e. it might change by a digit or two) but does not change if I connect the pin to 3.3V or ground.

This problem seems to extend to using the pins as digital inputs as well, the pins appear to be stuck low and do not change as the external voltage changes.

If I add the call to pinMode(PA0) to the above code, before the pin is read, then I see values as expected, both for digital and analog reads.

Is it possible the default pin setup is leaving the pins in the wrong state somehow? Obviously it's not a problem for me to add the pinMode call to my code, but some libraries or existing applications that depend on the default behaviour might not work as expected.

STM32L151 : stm32_TIM_variant_4.h:15:47: error: 'AF_NO_REMAP' undeclared here (not in a function); did you mean 'IS_TIM_REMAP'?

Hi,
I made a target with STM32L151CC which throws this error (LED blink example, timer used for delay function):
stm32_TIM_variant_4.h:15:47: error: 'AF_NO_REMAP' undeclared here (not in a function); did you mean 'IS_TIM_REMAP'?

For test purposes i tried :
#define AF_NO_REMAP 0 to pass the error, and then i got another error related to I2S (which i dont use):
stm32_gpio_af.c:136:17: error: 'chip_af_i2s_mck' undeclared (first use in this function); did you mean 'chip_af_i2s_ck'?

I previously made another target based on STM32L151C8 and these errors were not thrown, so this is somehow related to this variant only.

Does anyone have a clue on what the problem is?
Thanks.

Demo:12:33: error: LTDC_F746_Discovery.h: No such file or directory

Hi
I use 32F746GDISCOVERY board and tried it by Demo.ino from https://github.com/ChrisMicro/STM32GENERIC. After compile code it shown the error message below.
I use Windows 10 and Arduino 1.8.10.
I installed STM32GENERIC at
C:\Program Files (x86)\Arduino\hardware\STM32GENERIC-master\STM32\libraries\BoardExamples\examples\Discovery746NG\TFT\Demo
Could you suggest me to solve this problem?

Demo:12:33: error: LTDC_F746_Discovery.h: No such file or directory
#include "LTDC_F746_Discovery.h"
^
compilation terminated.
exit status 1
LTDC_F746_Discovery.h: No such file or directory

Thank you

Whetstone benchmarks to slow

STM32F103,72MHz is ok:
Loops: 1000, Iterations: 1, Duration: 13100 ms.
C Converted Single Precision Whetstones: 7.63 MIPS

Nucleo F030R8, 48Mhz?
Loops: 1000, Iterations: 1, Duration: 46423 ms.
C Converted Single Precision Whetstones: 2.15 MIPS

Add support for F401VE

Hello. Im working with marlin firmware for 3d printer that use your library. But my board is STEVAL-3DP001V1. Please, add support for STM32F401VE

STM32F746 EEPROM

The EEPROM example not working for STM32F7. While checking the library file. It has support only for STM32F1 and F4 boards. Is there any updated library for STM32F7???

Fail to compile sram_test for WaveShare F746IG

When try to compile this example:
`/** sram_test.ino sram(sdram) test for this board:
DISCOVERY_F746NG
DISCOVERY_F429ZI
ARMFLY_F407ZG
HASEE_III_F103ZE
ILLUMINATI_F407ZG
REDBULL_V2_F103ZE
WAVESHARE_F746IG
Allocate 256k ram, and write to Serial the results
*/
#include <Sram.h>
#include <LED.h>

void setup() {
Led.Init();
Serial.begin(115200);
}

uint32_t size = SRAM_LENTH / 2; /* define in bsp.h*/;
void loop() {
Serial.print("SRAM SIZE: 0x");
Serial.println(size * 2, HEX);
uint32_t start = millis();

uint32_t sum = 0;
uint32_t sum_check = 0;
uint16_t data;
for (int i = 0; i < size; i++) {
data = i & 0xffff;
sum += i & 0xffff;
BSP_SRAM_WriteData(i * 2, &data, 1) ; //uint16_data, addr*2
}

Serial.print("Write time: ");
Serial.print(millis() - start);
Serial.println(" ms");
start = millis();
Led.on();
for (int i = 0; i < size; i++) {
BSP_SRAM_ReadData(i * 2, &data, 1) ;
sum_check += data;
}
Led.off();

Serial.print("Read time: ");
Serial.print(millis() - start);
Serial.println(" ms");

Serial.print("Checksum should be:");
Serial.println(sum);
Serial.print("Checksum calculated:");
Serial.println(sum_check);

if (sum == sum_check) {
Serial.print("SDRAM is working with buffer size: ");
Serial.println(size);
} else {
Serial.println("SDRAM NOT WORKING !!!");
}

delay(5000);
}, Arduino IDE 1.85 generates this error:In file included from C:\Users\javier\Documents\Arduino\sram_test_WS_CORE746C-I\sram_test_WS_CORE746C-I.ino:11:0:

C:\arduino-1.8.5\hardware\STM32GENERIC\STM32\libraries\SRAM\src/Sram.h:5:17: fatal error: bsp.h: No such file or directory

compilation terminated.

exit status 1
Error compilando para la tarjeta F746x(216M).`

Error when compiling.

Arduino IDE: 1.8.
Windows 10 x64
Running the latest version of this library.
I'm just picking a random sketch from this library, but it happens to all the sketches I tried.

In file included from C:\Users\Lennart\Documents\Arduino\hardware\STM32GENERIC-master\STM32\cores\arduino/Stream.h:26:0,

                 from C:\Users\Lennart\Documents\Arduino\hardware\STM32GENERIC-master\STM32\cores\arduino\stm32\SerialUART.h:28,

                 from C:\Users\Lennart\Documents\Arduino\hardware\STM32GENERIC-master\STM32\cores\arduino\stm32\SerialUART.cpp:29:

C:\Users\Lennart\Documents\Arduino\hardware\STM32GENERIC-master\STM32\cores\arduino/Print.h:94:39: error: 'va_list' has not been declared

     size_t printf(const char* format, va_list);

                                       ^

exit status 1
Error compiling for board BLACK F407VE/ZE/ZG boards.


What am I doing wrong?

Sketch:

void setup()
{
  pinMode(LED0_BUILTIN, OUTPUT);
  pinMode(LED1_BUILTIN, OUTPUT);
  
  digitalWrite(LED0_BUILTIN, HIGH); // led off, led is active low
  digitalWrite(LED1_BUILTIN, HIGH); // led off, led is active low
}

void loop()
{
    digitalWrite(LED0_BUILTIN, LOW); // led on
    delay(1000);
    digitalWrite(LED0_BUILTIN, HIGH);// led off
    
    digitalWrite(LED1_BUILTIN, LOW); // led on
    delay(1000);
    digitalWrite(LED1_BUILTIN, HIGH); // led off
}

STM32F030 series test on Arduino IDE, ADC failed

Hi, All.
I'm testing STM32F030 Series F030F4 \ F030K6 \ Nucleo64 F030R8
SPI / Serial / PWM / digitalRead and Write functions tested OK.
But ADC input always got 0 on PA0-PA7 with about 500ms delay; (Use Arduino IDE example: AnalogInOutSerial)
Below information gotten from serialport: and displayed 0V on multimeter too.

sensor = 0 output = 0
sensor = 0 output = 0
sensor = 0 output = 0
sensor = 0 output = 0
sensor = 0 output = 0

What have I missed?

appreciate for any helps.

BR.

C.S Nol

Serial.available() not working properly

Looking on SerialUART.cpp the function is returning a bool condition instead os number of available bytes, a lot of libs use that like Nexion.
This is the current code:

int HardwareSerial::available() {
    return rxEnd != rxStart;
}

This is the fix:

int HardwareSerial::available() {
    //return rxEnd != rxStart;
    int size = (rxEnd % BUFFER_SIZE) - (rxStart % BUFFER_SIZE);
    if (size < 0) size += BUFFER_SIZE;
    return size;
}

Tested and working properly now.

STM32F407 Specs

Hi,
First I need to say thanks for this library. I think for STM32F4 familly it is the best arduino framework in comparison with other libraries.
As you may know The STM32F407VET6 chip has 192KB of ram but when I compile my code I see 128K.
Here is the output of arduino application:

Sketch uses 17748 bytes (3%) of program storage space. Maximum is 524288 bytes.
Global variables use 3920 bytes (2%) of dynamic memory, leaving 127152 bytes for local variables. Maximum is 131072 bytes.

I found the port to Atom application from here. And I think it shows the true value:

Building .pioenvs\black_F407VE\firmware.bin
Memory Usage -> http://bit.ly/pio-memory-usage
DATA: [ ] 2.0% (used 4016 bytes from 196608 bytes)
PROGRAM: [ ] 3.7% (used 19636 bytes from 524288 bytes)
[SUCCESS] Took 3.62 seconds

Is there any diffrence of STM cores between these two apps?
Is there any limits or it is a simple faulty compiler message?
Thanks.

__HAL_AFIO_REMAP_SWJ_ENABLE(); missing definition for L1 and F3

Apparently the definition for __HAL_AFIO_REMAP_SWJ_ENABLE is missing for L1 and F3, i added some boards based on L151C8 and F303CC and as soon as i compile it throws this error, when i compile for F103 no problem because for F1 the definition is in PinAF_STM32F1.h, also the USB VCP callbacks were missing or F3 (i added them manually from a cubemx project)

...STM32/cores/arduino/main.cpp:55:37: error: '__HAL_AFIO_REMAP_SWJ_ENABLE' was not declared in this scope __HAL_AFIO_REMAP_SWJ_ENABLE();

Discovery f303v stack location

The Discovery f303v stack location is set to 0xA0000 after the RAM start in ldscript.ld. But the f303v has only 40K RAM. I think it should be 0xA000.

build error stm32f7

I try build F746NG, it's error.
arm-none-eabi-g++: error: unrecognized argument in option '-mcpu=cortex-m7'.
How i can fix it?

BluePill ILI9341 not working with certain pins

I have connected an ILI9341 display to a BluePill STM32F103.
It is working with the following configuration:

#define TFT_DC PA2
#define TFT_RST PA3
#define TFT_CS PA4

#define TFT_CLK PA5
#define TFT_MISO PA6
#define TFT_MOSI PA7

If I try to use PB3, PB4, PA14 it is not working.

My guess: Probably JTAG is enabled on the BluePill and it blocks the pins.

Support for adding the nucleo H743ZI

Daniel first of all thanks for supporting us with the generic kernel for STM32 in the arduino IDE, it works very well in the 1.8.13 IDE. In the team we have been able to work on a library that can control screens with EVE FT81x chips.

Following the all the steps to add the nucleo H743ZI variant to the generic core, it gives us this result:

arm-none-eabi-g++: error: missing argument to '-mcpu='
exit status 1
Error compilando para la tarjeta Nucleo-144 boards.

What else must be added for the variant to respond correctly?

chain: gcc-arm-none-eabi-7-2017-q4-major-win32.zip

-DVECT_TAB_OFFSET not working?

Hi

I've created a new variant with a new ld file that should compile and link to 0x08010000 and I pass the -DVECT_TAB_OFFSET=0x10000 during compilation.

The bootloader boots successfully from 0x08000000 as expected but the compiled code flashed to location 0x08010000 does not execute.

I built a sample blink using the compiler on linux and if I flash that to 0x08010000 the bootloader seems to start it properly...

Is there something I am missing?

undefined reference to `pulseIn'

Hello!

Trying to compile for STM32F407VET6 black board - and get the following error messages:

undefined reference to pulseIn' undefined reference to shiftOut'

By investigating the Arduino.h file I found the declaration of pulseIn and shiftOut, but can't find any implementation of these functions.

What I'm doing wrong?

FSMCLCD.ino on black 407ZET board

Hi,

I'm struggling to get FSMC working on the 407ZET board which uses A6 and NE4 for external LCD interface.
When I modify the FSMCLCD.ino example to use
#define LCD_REG (*((volatile unsigned short *) 0x6C000000))
#define LCD_RAM (*((volatile unsigned short *) 0x6C000000 + (1 << 6)))
The execution crashes and builtin LEDs stop flashing.

When I change back to
#define LCD_REG (*((volatile unsigned short *) 0x60000000))
#define LCD_RAM (*((volatile unsigned short *) 0x60000000 + (1 << 6)))
I can see NE1 and A6 toggling as excpected.

Do I need somehow to additionally allow somewhere access to addresses 0x6C...?

GPL issue: dfu-utils

dfu-utils is GPL so source for it (and maybe even for libusb) should be included.

add custom board - setting default pins

I'm trying to figure out how to set the default GPIO pins for a custom board (based of a STM32F407VG).

I've managed to add a menu item for selecting a different UART as the default Serial, but am not sure how to set the default pins for it.
Since some libraries (e.g. the SDfat lib) automatically print to the default Serial, rather than letting you select which stream to print to, it's quite important to be able to set this right.

Thanks for any pointers!

Errors when compiling TFT example sketches

I am trying to compile the TFT/Demo example but getting the error:

In file included from /Users/peter/Documents/Arduino/libraries/Adafruit_GFX_Library/Adafruit_GrayOLED.h:31:0,
                 from /Users/peter/Documents/Arduino/libraries/Adafruit_GFX_Library/Adafruit_GrayOLED.cpp:20:
/Users/peter/Documents/Arduino/libraries/Adafruit_BusIO/Adafruit_SPIDevice.h:62:22: error: 'BitOrder' has not been declared
                      BitOrder dataOrder = SPI_BITORDER_MSBFIRST,
                      ^~~~~~~~
/Users/peter/Documents/Arduino/libraries/Adafruit_BusIO/Adafruit_SPIDevice.h:67:22: error: 'BitOrder' has not been declared
                      BitOrder dataOrder = SPI_BITORDER_MSBFIRST,
                      ^~~~~~~~
/Users/peter/Documents/Arduino/libraries/Adafruit_BusIO/Adafruit_SPIDevice.h:88:3: error: 'BitOrder' does not name a type
   BitOrder _dataOrder;

This happens also when I try to compile the other TFT relatext examples.

Environment:
Arduino 1.8.13 (MacOS)
Adafruit Bus IO library 1.7.1

F4 HAL does not allow overriding of VECT_TAB_OFFSET

I'm not sure the best way to handle this, but the F4 does not allow VECT_TAB_OFFSET to be overridden

https://github.com/danieleff/STM32GENERIC/blob/master/STM32/system/STM32F4/HAL_Src/system_stm32f4xx.c#L111

Unlike the F1, which has a "guard" indef
https://github.com/danieleff/STM32GENERIC/blob/master/STM32/system/STM32F1/HAL_Src/system_stm32f1xx.c#L113-L116

Is the best fix for this, simply for me to manually update file , to add the #ifdef and generate a PR for this update ?

PWM using analogWrite sometimes stops

When the PWM interrupt handler is delayed by another interrupt using the same or higher priority the PWM can stop working for a long time. The problem can be reproduced using the following example:

#include <HardwareTimer.h>

#define PWM_PIN_1 PC7
#define PWM_PIN_2 PC6
#define TIMER_PIN PC8

void interrupt()
{
    digitalWrite(TIMER_PIN, 1);
    for (int i = 0; i < 2048; i++)
    {
        __asm__("nop;");
    }
    digitalWrite(TIMER_PIN, 0);
}

void setup()
{
    pinMode(TIMER_PIN, 1);

    Timer1.setPeriod(5000);
    Timer1.attachInterrupt(interrupt);
    Timer1.resume();

    analogWrite(PWM_PIN_1, 128);
}

byte ratio = 0;

void loop()
{ 
    analogWrite(PWM_PIN_2, ratio++);

    delay(50);
}

This screenshot shows that the PWM1 & PWM2 signals stop while the TIMER signal continues to pulse.

2018-04-03 19_35_23-saleae logic software

Bug in STM32/cores/arduino/stm32/SerialUART.h

Hi

There's a bug in your generation script for SerialUART.h

Serial4 is not defined

#if defined(USART4) || defined(UART4)
extern SerialUART SerialUART4;
#define Serial5 SerialUART5
#endif

#if defined(USART5) || defined(UART5)
extern SerialUART SerialUART5;
#define Serial5 SerialUART5
#endif

I2S library some issues

Hello,
I hope you do not lost interest in further developing this core!
There are several issues with the I2S library, tested on a STM32F407VET (black) board.
First, a bug:
Using two instances of the library I2S + I2S2 (=SPI2+SPI3) causes a crash with the I2S.write(val); function.
To be clear: Both (I2S,I2S2) are working in single mode without problems.
But using:
I2SClass I2S_a(SPI2, PB15 /*DIN*/ , PB12 /*LRC*/, PB13 /*SCLK*/, PC6 /*MCK*/);
I2SClass I2S(SPI3, PB5 /*DIN*/ , PA4 /*LRC*/, PB3 /*SCLK*/, PC7 /*MCK*/);
and
I2S.begin(I2S_PHILIPS_MODE, SAMPLINGFREQUENCY, 16);
I2S_a.begin(I2S_PHILIPS_MODE, SAMPLINGFREQUENCY, 16);
works until:
I2S.write(val); and(!) I2S_a.write(val); is executed.
I thing the problem has something to do with the DMA function. As I know both (SPI2+3) are on the same DMA1 channel (0):
Stream4: SPI2_TX
Stream5: SPI3_TX
So maybe there must be a DMA release or something?
I suspect, this bug also occurs using I2S (SPI2) and common SPI3 both in DMA mode (or vice versa)
(I don't know if it's overall possible using two streams on the same channel simultaneously, I used only F1xx in the past and the DMA controller is different)

Second:
Overall functionality - Maybe it would be better using a circular buffer and a IRQ callback function (half buffer, full buffer) as SteveStrong used it in the leaflabs core. So the buffer will be filled automatically without taking care about when the buffer is empty. Even using half/full buffer routines will significant prevents dropouts. More advantage about this: This function/IRQ can set to any priority the user needs.
More about this here:
http://stm32duino.com/viewtopic.php?f=51&t=4054

Thanks and regards
Matthias (madias in STM32duino forum)

HardwareTimer.cpp line 297

This is great work. I am trying to generate a three phase motor drive using PWM with three complementary half bridges... I suspect there may be a typo at line 297. I think the OCMode should be set to TIM_OCMODE_INACTIVE instead of TIM_OCMODE_ACTIVE. I think this is needed for the active LOW channel of the PWM...

Full disclosure: I am a newbie with STM32 coding so I may be wrong so I hope you can check this...

The file is in HardwareTimer.cpp at line 297.

    case TIMER_OUTPUT_COMPARE_ACTIVE:
        channelOC[channel - 1].OCMode = TIM_OCMODE_ACTIVE;
        pinMode = GPIO_MODE_AF_PP;
        break;

    case TIMER_OUTPUT_COMPARE_INACTIVE:
        **channelOC[channel - 1].OCMode = TIM_OCMODE_ACTIVE;    // Should this be TIM_OCMODE_INACTIVE ?**
        pinMode = GPIO_MODE_AF_PP;
        break;

USB doesnt work for STM32F3xx

Hi, i made a target folder for STM32F303CCT6 based on the indications so using a USB VCP STM32CubeMx project, in variant.c i used the clock configuration from the STM32CubeMX project, i also added usbd_conf_F3.c in the core USB folder (taken from the working STM32CubeMX project).

When i test with blink example If i set USB : Serial (Virtual COM port) the board stalls at runtime, if i set USB : disabled, it blinks as it should, what could be the problem?
variant.c.zip
usbd_conf_F3.c.zip

ADC tests

Daniel,

I've been testing ADC functions.

1. Issue with _weak prototypes for interrupt functions in stm32f4xx_hal_adc.c

When I started working on ADC interrupts I got the following error:

...Arduino\hardware\STM32GENERIC\STM32\system/STM32F4/HAL_Src/stm32f4xx_hal_adc.c:958: undefined reference to `HAL_ADCEx_InjectedConvCpltCallback'

For some reason the _weak prototype for HAL_ADCEx_InjectedConvCpltCallback( ) at stm32f4xx_hal_adc_ex.c : 769 isn't providing coverage, when the function isn't needed.

Including a null routine in the user code fixes this issue (not ideal) - the additional null routine isn't required in Frederic's implementation.

2. ADC Extended functions missing

The extended ADC functions in stm32f4xx_hal_adc_ex.c are not available.

The solution is to add the second #include in the code below at stm32f4xx_hal_conf.h : 269
and properly define the callback function in local code.

#ifdef HAL_ADC_MODULE_ENABLED
  #include "stm32f4xx_hal_adc.h"
  #include "stm32f4xx_hal_adc_ex.h"
#endif /* HAL_ADC_MODULE_ENABLED */

I suspect the library spl.a might need recompilation as well - as including the stm32f4xx_hal_adc_ex.h file in user code, or in stm32f4xx_hal_conf.h, doesn't make the error go away.

Richard

STM32F7 TRNG

STM32F7 TRNG not working rand() or random() produce same sequence after reset

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.