Comments (4)
Hi @xiezhoubin
Could you be more precise?
Sketch? Board used? Core version?....
from arduino_core_stm32.
``> Hi @xiezhoubin Could you be more precise? Sketch? Board used? Core version?....
chip:stm32f030cct6
Core version:2.7.1
code:
#include <Arduino.h>
HardwareSerial mySerial(PA10, PA9);
volatile uint32_t count = 0;
volatile bool flag = false;
void callback() {
if (flag) {
count++;
}
}
void setup() {
delay(1000);
mySerial.begin(115200);
mySerial.setTimeout(5);
mySerial.println("\n start...");
pinMode(groundSenseDetectionPin, INPUT_PULLUP);
attachInterrupt(digitalPinToInterrupt(PB15), callback, CHANGE);
mySerial.println("\n ok");
}
void loop() {
mySerial.println("count:" + String(count));
delay(100);
}
from arduino_core_stm32.
I have tested that the PA5 pin is working and the program can run normally; If it is PB15, the program will get stuck in "attachInterrupt"
from arduino_core_stm32.
Your code could not be built as groundSenseDetectionPin
is not declared and not functional as flag
is always false
. So counter
is always 0.
I've tested with the code below and a Nucleo F030R8 as I have no board with F030CC, anyway same series and it works as expected.
// HardwareSerial mySerial(PA10, PA9);
#define mySerial Serial
volatile uint32_t count = 0;
volatile bool flag = false;
void callback() {
// if (flag) {
count++;
// }
}
void setup() {
delay(1000);
mySerial.begin(115200);
mySerial.setTimeout(5);
mySerial.println("\n start...");
pinMode(PB15, INPUT_PULLUP);
attachInterrupt(digitalPinToInterrupt(PB15), callback, CHANGE);
mySerial.println("\n ok");
}
void loop() {
mySerial.println("count:" + String(count));
delay(100);
}
I've also tried with the Nucleo F030R8 hardware but compiling for a Generic F030C8 and same no issue.
How you know it get stuck in attach interrupt, did you try to debug? My guess is the PB15 state always change and the callback is called permanently.
It is linked to your hardware.
from arduino_core_stm32.
Related Issues (20)
- Error: 13 INTERNAL: Library install failed: moving extracted archive to destination dir: library not valid HOT 2
- Nucleo-F439ZI support HOT 4
- STM32F103 RTC BKP Registers 16bit not 32bit HOT 4
- I2S on STM32F401
- Low power timers are missing in PeripheralPins.c
- Is the STM32F030CCT6 chip supported? HOT 2
- STM32F030CCT6 InputCapture Problem HOT 3
- About the application of DMA&ADC joint function of STM32 developed by CubeIDE on ArduinoIDE
- Nucleo F446ZE supported since v2.7.0, but json file missing Arduino core entries under PlatformIO? HOT 2
- Very, very, very minor doc bug HOT 1
- Arduino_Core_STM32 not compatible with Arduino Modbus library
- STM32F030F4P6 not working with stm32duino 2.0.0 or later.
- "blue pill" w/STMF103C8 USB-CDC Serial not reading from host HOT 1
- `HardwareSerial::flush()` returns immediately if called as `Stream*->flush()` interface HOT 2
- USBD CDC package maybe splited when using SerialUSB.write() HOT 2
- USE_FULL_ASSERT results in failed build due to missing stm32_assert.h HOT 1
- Option to disable Clock Security System (CSS) in setup
- Wire.h i2c slave not working, STM32F103 is freezing.. HOT 1
- h503 .cfg Files to enable Debug
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from arduino_core_stm32.