Closed
Description
Describe the bug
I2C slave does not recieve requests.
To Reproduce
#include <Wire.h>
long lastms;
volatile int x = 0;
volatile int y = 0;
static void receiveEvent(int howMany) {
x = Wire.read();
}
static void requestEvent() {
y = 1;
}
void setup() {
Serial.begin(115200);
pinMode(PB6, INPUT); //PB6=SCL
pinMode(PB7, INPUT); //PB7=setSDA
pinMode(PC13, OUTPUT);
Wire.setSCL(PB6);
Wire.setSDA(PB7);
Wire.begin(11); // join i2c bus as slave
//Wire.onRequest(requestEvent); // register event
Wire.onReceive(receiveEvent); // register event
lastms = millis();
}
void loop() {
if (millis() > lastms + 1000) {
Serial.print("-");
lastms = millis();
}
if (x != 0) {
Serial.print("U:0x");
Serial.println(x, HEX);
//digitalWrite(PC13,!digitalRead(PC13));
x = 0;
}
if (y != 0) {
Serial.println("V");
y = 0;
}
}
Steps to reproduce the behavior:
- Run the code om STM32F103Cx
- the code expects requests from master to address x0xB / 11d
- I see the data requests using a oscolloscope/logic analyzer on PB6/PB7
- The software outputs only "-"
Expected behavior
I'd expect it to work like it does on Atmega/atmel controllers - where this code works. see arduino/ArduinoCore-API#241
Than I rebuilt it all using Arduino Core 2.9.0 (current release)
On Core 2.9.0 - the PB6 is at least not pulled low - which is good, but it still does not work.
Desktop (please complete the following information):
- OS: Linux Ubuntu24.10
- Arduino IDE version: 2.3.3
- STM32 core version: 2.9.0
- Tools menu settings if not the default: [e.g. Newlib Standard, No Serial]
- Upload method: SWD
Board (please complete the following information):
- Name: Bluepill STM32F103C8
- Hardware Revision: n/a
- Extra hardware used if any: -
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Done