STM32F103C8T6 problem with EEPPROM..

Post here all questions related to LibMaple core if you can't find a relevant section!
iz7jxj
Posts: 10
Joined: Sat Aug 21, 2021 1:58 pm

STM32F103C8T6 problem with EEPPROM..

Post by iz7jxj »

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 ...!!!!!
.rpv
Posts: 43
Joined: Wed Dec 18, 2019 10:19 pm

Re: STM32F103C8T6 problem with EEPPROM..

Post by .rpv »

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.
mrburnette
Posts: 633
Joined: Thu Dec 19, 2019 1:23 am
Answers: 7

Re: STM32F103C8T6 problem with EEPPROM..

Post by mrburnette »

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.
iz7jxj
Posts: 10
Joined: Sat Aug 21, 2021 1:58 pm

Re: STM32F103C8T6 problem with EEPPROM..

Post by iz7jxj »

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.
Thanks for the reply, but to me, nothing works yet.
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.
iz7jxj
Posts: 10
Joined: Sat Aug 21, 2021 1:58 pm

Re: STM32F103C8T6 problem with EEPPROM..

Post by iz7jxj »

.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.
this library doesn't work for me at all ..
I am using a BLUE PILL.
the AVR library give ERRORS
Thanks anyway .... maybe I'm doing something wrong
.rpv
Posts: 43
Joined: Wed Dec 18, 2019 10:19 pm

Re: STM32F103C8T6 problem with EEPPROM..

Post by .rpv »

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.
iz7jxj
Posts: 10
Joined: Sat Aug 21, 2021 1:58 pm

Re: STM32F103C8T6 problem with EEPPROM..

Post by iz7jxj »

.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.
The BLUE PILL works perfectly with other Skechs and the Arduino IDE.
I send you photos of the configuration.
but I don't know how to do it .....
iz7jxj
Posts: 10
Joined: Sat Aug 21, 2021 1:58 pm

Re: STM32F103C8T6 problem with EEPPROM..

Post by iz7jxj »

.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
IMG-20210822-WA0035.jpg (28.99 KiB) Viewed 4094 times
iz7jxj
Posts: 10
Joined: Sat Aug 21, 2021 1:58 pm

Re: STM32F103C8T6 problem with EEPPROM..

Post by iz7jxj »

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
Attachments
code.jpg
code.jpg (48.35 KiB) Viewed 4090 times
.rpv
Posts: 43
Joined: Wed Dec 18, 2019 10:19 pm

Re: STM32F103C8T6 problem with EEPPROM..

Post by .rpv »

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:

Code: Select all

unsigned long x=1000000;

setup(){
//...//
Serial.print(x);
}
But I'll expect funny things on this:

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);
}
For the previous I'll use:

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);
}
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);
Post Reply

Return to “General discussion”