2025-02-28 9:24 AM - last edited on 2025-02-28 10:24 AM by Tesla DeLorean
Hello,
I'm using an STM32C011J6M6 with the Arduino IDE to register with theST25DV64KC-IE6S3 's EEPROM.
I previously used the ATTiny85 and would like to replace it with the STM32C0 to maintain the entire solution with ST components.
I made some changes to the code but I can't register with the SDA/SCL of the STM32C0.
According to the datasheet, I should use pin 8 as SCL and pin 1 as SDA, but the registration with the EEPROM isn't working, I tested the eeprom address with ATTiny85 and it is 0x53
In the project with the ATTiny85, I didn't need to declare the terminal to perform this registration. Does anyone have a programming example that communicates via I2C?
#include <Wire.h>
#include <EEPROM.h>
#define EEPROM_ADDRESS 0x53
#define START_ADDRESS 0
int currentAddress = START_ADDRESS;
int counter = 0;
void setup() {
Wire.begin();
}
void loop() {
writeToEEPROM(currentAddress, currentAddress);
currentAddress++;
counter = (counter > 499) ? 0 : counter + 1;
currentAddress = (currentAddress >= 999) ? START_ADDRESS : currentAddress;
...
void writeToEEPROM(int address, uint8_t value) {
Wire.beginTransmission(EEPROM_ADDRESS);
Wire.write((address >> 8) & 0xFF); // High address byte
Wire.write(address & 0xFF); // Low address byte
Wire.write(value);
Wire.endTransmission();
}
2025-02-28 10:26 AM
Please use the code pasting tool "</>" icon rather than dump partial source in-line. This way the formatting/indentation won't be lost.
You can also EDIT your own posts via the "V" to the upper right of your post(s)