STM32F4x1 BlackPill issue with I2C as slave
Posted: Fri Aug 20, 2021 10:36 am
Hi all,
I am facing issue using I2C as slave: I can not make it work and see from Jetson Nano.
All lines have pull up resistors.
It is not an issue with Jetson Nano as my servo controller is perfectly detected.
But my black pill is not detected.
I also have error message on the jetson nano found with dmesg command:
[ 7843.509985] tegra-i2c 7000c400.i2c: pio timed out addr: 0x4 tlen:12 rlen:4
[ 7843.517357] tegra-i2c 7000c400.i2c: --- register dump for debugging ----
[ 7843.527385] tegra-i2c 7000c400.i2c: I2C_CNFG - 0x22c00
[ 7843.533331] tegra-i2c 7000c400.i2c: I2C_PACKET_TRANSFER_STATUS - 0x10001
[ 7843.540243] tegra-i2c 7000c400.i2c: I2C_FIFO_CONTROL - 0xe0
[ 7843.546020] tegra-i2c 7000c400.i2c: I2C_FIFO_STATUS - 0x800080
[ 7843.552002] tegra-i2c 7000c400.i2c: I2C_INT_MASK - 0x7d
[ 7843.557351] tegra-i2c 7000c400.i2c: I2C_INT_STATUS - 0x2
[ 7843.562806] tegra-i2c 7000c400.i2c: i2c transfer timed out addr: 0x4
[ 7853.749749] tegra-i2c 7000c400.i2c: pio timed out addr: 0x5 tlen:12 rlen:4
Any help is welcome!
Many thanks guys!
Here is my code:
I am facing issue using I2C as slave: I can not make it work and see from Jetson Nano.
All lines have pull up resistors.
It is not an issue with Jetson Nano as my servo controller is perfectly detected.
But my black pill is not detected.
I also have error message on the jetson nano found with dmesg command:
[ 7843.509985] tegra-i2c 7000c400.i2c: pio timed out addr: 0x4 tlen:12 rlen:4
[ 7843.517357] tegra-i2c 7000c400.i2c: --- register dump for debugging ----
[ 7843.527385] tegra-i2c 7000c400.i2c: I2C_CNFG - 0x22c00
[ 7843.533331] tegra-i2c 7000c400.i2c: I2C_PACKET_TRANSFER_STATUS - 0x10001
[ 7843.540243] tegra-i2c 7000c400.i2c: I2C_FIFO_CONTROL - 0xe0
[ 7843.546020] tegra-i2c 7000c400.i2c: I2C_FIFO_STATUS - 0x800080
[ 7843.552002] tegra-i2c 7000c400.i2c: I2C_INT_MASK - 0x7d
[ 7843.557351] tegra-i2c 7000c400.i2c: I2C_INT_STATUS - 0x2
[ 7843.562806] tegra-i2c 7000c400.i2c: i2c transfer timed out addr: 0x4
[ 7853.749749] tegra-i2c 7000c400.i2c: pio timed out addr: 0x5 tlen:12 rlen:4
Any help is welcome!
Many thanks guys!
Here is my code:
Code: Select all
#include <Arduino.h>
#include <Wire.h>
#define SLAVE_SDA PB7
#define SLAVE_SCL PB6
#define SLAVE_ADR 0x4
TwoWire slaveI2C (SLAVE_SDA,SLAVE_SCL) ;
void receiveEvent (int) ;
void setup() {
// put your setup code here, to run once:
Serial.begin(115200) ;
slaveI2C.setClock(400000) ;
slaveI2C.begin(SLAVE_ADR) ;
slaveI2C.onReceive(receiveEvent) ;
}
void loop() {
while (true) {
delay(100) ;
}
}
void receiveEvent (int howMany) {
if (slaveI2C.available()<1)
return ;
uint8_t command=slaveI2C.read() ;
}