STM32F103C8T6 problem with EEPPROM..
STM32F103C8T6 problem with EEPPROM..
Hello everyone!
I wanted to ask for help as I want to transfer a sketch made by me in Arduino Uno to the Bluepill STM32F103C8T6.
The only drawback I found is the handling of the Eeprom. Now I'll explain how it works: by pressing a key you go to a SubSketch to configure 3 variables. On Arduino everything is perfect, but on the bluepill it obviously doesn't work.
The library used on Arduino is "EEPROMex.h" with the usual reading "EEPROM.readLong" and writing "EEPROM.writeLong".
I would like some help to solve this problem in the simplest way possible.
The 3 variables are:
2)- (UNSIGNED LONG) of around value 27000000
1)- ( INT ) around value from -200 to 200
Sorry for my school English. I only speak Italian and Spanish.
Thanks ...!!!!!
I wanted to ask for help as I want to transfer a sketch made by me in Arduino Uno to the Bluepill STM32F103C8T6.
The only drawback I found is the handling of the Eeprom. Now I'll explain how it works: by pressing a key you go to a SubSketch to configure 3 variables. On Arduino everything is perfect, but on the bluepill it obviously doesn't work.
The library used on Arduino is "EEPROMex.h" with the usual reading "EEPROM.readLong" and writing "EEPROM.writeLong".
I would like some help to solve this problem in the simplest way possible.
The 3 variables are:
2)- (UNSIGNED LONG) of around value 27000000
1)- ( INT ) around value from -200 to 200
Sorry for my school English. I only speak Italian and Spanish.
Thanks ...!!!!!
Re: STM32F103C8T6 problem with EEPPROM..
Hi, are you using an external eeprom?, if you're using the internal flash as eeprom and if you're using the stcore you can use the standar eeprom library, no need to use external libraries, you can use the standard API:
https://www.arduino.cc/en/Reference/EEPROM
The libmaple variants also support the api, just don't have support for the get/put functions.
https://www.arduino.cc/en/Reference/EEPROM
The libmaple variants also support the api, just don't have support for the get/put functions.
-
- Posts: 633
- Joined: Thu Dec 19, 2019 1:23 am
Re: STM32F103C8T6 problem with EEPPROM..
The official, tested/supported, eeprom lib is here:
https://github.com/stm32duino/Arduino_C ... /libraries
Other libraries "may" work or may not without changes; the forum may be able to help, but no guarantees. It is best to utilize the tested library.
https://github.com/stm32duino/Arduino_C ... /libraries
Other libraries "may" work or may not without changes; the forum may be able to help, but no guarantees. It is best to utilize the tested library.
Re: STM32F103C8T6 problem with EEPPROM..
Thanks for the reply, but to me, nothing works yet.mrburnette wrote: Sun Aug 22, 2021 1:38 am The official, tested/supported, eeprom lib is here:
https://github.com/stm32duino/Arduino_C ... /libraries
Other libraries "may" work or may not without changes; the forum may be able to help, but no guarantees. It is best to utilize the tested library.
I would like a simple example to write and read a variable (unsignedLong) on the EEPRON if it is possible.
I think I have problems with the EEPROM library.
When I run an example of the library it gives me ERROR ..
"" class EEPROMClass has no member named 'length'.
How is that possible if it is an example of the library ????
I don't use external EEPROM, I would like to use internal flash.
Re: STM32F103C8T6 problem with EEPPROM..
this library doesn't work for me at all ...rpv wrote: Sat Aug 21, 2021 10:24 pm Hi, are you using an external eeprom?, if you're using the internal flash as eeprom and if you're using the stcore you can use the standar eeprom library, no need to use external libraries, you can use the standard API:
https://www.arduino.cc/en/Reference/EEPROM
The libmaple variants also support the api, just don't have support for the get/put functions.
I am using a BLUE PILL.
the AVR library give ERRORS
Thanks anyway .... maybe I'm doing something wrong
Re: STM32F103C8T6 problem with EEPPROM..
You aren't posting any info or the actual errors that you're getting, but it seems that you aren't selecting the right board on the arduino ide or you core installation on the IDE may be incomplete.
The eeprom libraries are supplied on both STCore and on libmaple-type cores and neither should give you any compilation error.
The eeprom libraries are supplied on both STCore and on libmaple-type cores and neither should give you any compilation error.
Re: STM32F103C8T6 problem with EEPPROM..
The BLUE PILL works perfectly with other Skechs and the Arduino IDE..rpv wrote: Sun Aug 22, 2021 9:55 am You aren't posting any info or the actual errors that you're getting, but it seems that you aren't selecting the right board on the arduino ide or you core installation on the IDE may be incomplete.
The eeprom libraries are supplied on both STCore and on libmaple-type cores and neither should give you any compilation error.
I send you photos of the configuration.
but I don't know how to do it .....
Re: STM32F103C8T6 problem with EEPPROM..
.rpv wrote: Sun Aug 22, 2021 9:55 am You aren't posting any info or the actual errors that you're getting, but it seems that you aren't selecting the right board on the arduino ide or you core installation on the IDE may be incomplete.
The eeprom libraries are supplied on both STCore and on libmaple-type cores and neither should give you any compilation error.
- Attachments
-
- IMG-20210822-WA0035.jpg (28.99 KiB) Viewed 8115 times
Re: STM32F103C8T6 problem with EEPPROM..
hi....
Someone who is not a donkey like me, explain to me why this thing happens ???
Instead of writing or reading 10,000,000.
Thanks in advance
Someone who is not a donkey like me, explain to me why this thing happens ???
Instead of writing or reading 10,000,000.
Thanks in advance
- Attachments
-
- code.jpg (48.35 KiB) Viewed 8111 times
Re: STM32F103C8T6 problem with EEPPROM..
Ok, first, in my experience using unsigned long it's problematic if you don't specify literally on each mention/operation
Something like this should work:
But I'll expect funny things on this:
For the previous I'll use:
On the eeprom problems, you seems to use ST core, but I didn't see any errors.
The EEPROM.read/EEPROM.write are just for single byte read/write, but using stcore you can use instead:
https://www.arduino.cc/en/Reference/EEPROMGet
https://www.arduino.cc/en/Reference/EEPROMPut
also, for the address you're giving (0x10) 10000 address, the flash eeprom it's just something like 1k-2k, so you should do something like:
EEPROM.get(0,iftrans);
and/or
EEPROM.put(0,iftrans);
Something like this should work:
Code: Select all
unsigned long x=1000000;
setup(){
//...//
Serial.print(x);
}
Code: Select all
unsigned long x;
setup(){
//...//
x=1000000;
Serial.print(x);
}
Code: Select all
unsigned long x=1000000;
setup(){
//...//
x=x*5;
Serial.print(x);
}
Code: Select all
unsigned long x;
setup(){
//...//
x=(unsigned long)1000000;
Serial.print(x);
}
Code: Select all
unsigned long x=1000000;
setup(){
//...//
x=x*(unsigned long)5;
Serial.print(x);
}
The EEPROM.read/EEPROM.write are just for single byte read/write, but using stcore you can use instead:
https://www.arduino.cc/en/Reference/EEPROMGet
https://www.arduino.cc/en/Reference/EEPROMPut
also, for the address you're giving (0x10) 10000 address, the flash eeprom it's just something like 1k-2k, so you should do something like:
EEPROM.get(0,iftrans);
and/or
EEPROM.put(0,iftrans);