How to access Roger's libraries

Development environment specific, Arduino, Eclipse, VS2013, Em::Blocks etc
Post Reply
k1rjl
Posts: 1
Joined: Thu Oct 22, 2020 1:41 am

How to access Roger's libraries

Post by k1rjl »

Please excuse my ignorance. I'm a new user trying to build code dependent on Roger's core. I'm using the latest Arduino (1.8.13). I think I've setup the IDE and Roger's code per the instructions. This is on a mac running current versions of the Apple software. Roger's core is in ~/Documents/Arduino/hardware/Arduino_STM32-master. The code I'm trying to build needs Roger's EEPROM library. The correct code is there along with other necessary libraries but isn't being referenced. How do I get the IDE to use those libraries? The library manager doesn't seem to see them.

stevestrong
Posts: 390
Joined: Fri Dec 27, 2019 4:53 pm
Answers: 7
Location: Munich, Germany
Contact:

Re: How to access Roger's libraries

Post by stevestrong »

You should first select a board and then you will see the EEPROM examples in Arduino under File->Examples->Examples for...board.
Which board do you use?

FerroFerido
Posts: 12
Joined: Tue Nov 17, 2020 11:10 pm

Re: How to access Roger's libraries

Post by FerroFerido »

Man, anyone can help me? I need save 7200 bytes in EEPROM On BluePill, but I'm not able to save more than 508 Bytes, know you who save more bytes in EEPROM?

Code: Select all

#include <EEPROM.h>


#include "EEPROM.h"
#define espacoEEPROM 57600
#define botao PB12
#define botao2 PB13
int x;
int potenciometro;
float i;
#define Sensor5 PA5
byte temp5 ;

int estadocircuito = 0;

int estadobotao;
int estadobotao2;

int estadoanteriorbotao;
int estadoanteriorbotao2;

//const int addressEEPROM_min = 0;              // Specify the address restrictions you want to use.
//const int addressEEPROM_max = 4095;

void setup() {
  // put your setup code here, to run once:
  pinMode(Sensor5, INPUT_ANALOG);
  pinMode(botao, INPUT_PULLDOWN);
  pinMode(botao2, INPUT_PULLDOWN);
  pinMode(PC13, OUTPUT);

  estadoanteriorbotao = digitalRead(botao);
  estadoanteriorbotao2 = digitalRead(botao2);
}

void loop() {
  /*/ put your main code here, to run repeatedly:
    potenciometro = analogRead(PA5);
    EEPROM.write(1,potenciometro);//EEPROM.write(endereço, dado);
    i = EEPROM.read(1);
    Serial.begin(9600);
    Serial.print("valor na eeprom é:");
    Serial.println(i);
  */

  /* AQUI É TUDO RELACIONADO AO BOTAO*/
  estadobotao = digitalRead(botao);
  if ((estadobotao == HIGH) && (estadoanteriorbotao == LOW)) {

    if (estadocircuito < 2) {
      estadocircuito = estadocircuito + 1;

    } else {
      estadocircuito = 0;
    }
  }

  estadoanteriorbotao = estadobotao;

  estadobotao2 = digitalRead(botao2);
  if ((estadobotao2 == HIGH) && (estadoanteriorbotao2 == LOW)) {

    if (estadocircuito == 0) {
      estadocircuito = estadocircuito + 2;

    } else {
      estadocircuito = 0;
    }
  }

  estadoanteriorbotao2 = estadobotao2;
  /* AQUI ACABA TUDO RELACIONADO AO BOTAO*/
      EEPROM.PageBase0 = 0x801F000;
      EEPROM.PageBase1 = 0x801F800;

      EEPROM.PageSize  = 0x800;

  if (estadocircuito == 0) {
    digitalWrite(PC13, HIGH);
    delay(1000);
    digitalWrite(PC13, LOW);
    delay(1000);
    Serial.begin (9600);
    Serial.println("Aperta pra gravar");


    // Serial.println(analogRead(Sensor5));*/
  }
  if (estadocircuito == 1) {
    int b = 0;
    

    for (int a = 0; a < 720; a++) {



      digitalWrite(PC13, HIGH);
      temp5 = ((analogRead(Sensor5)) * (3.6 / 4095)) / 0.01;

      EEPROM.write(b, temp5);
      Serial.print(b);
      Serial.print("<------");
      Serial.println(EEPROM.read(b));
      delay(500);

      b++;



    }
    estadocircuito = 0;

  }

  if (estadocircuito == 2) {
    int b = 0;

    for (int a = 0; a < 7200; a++) {
 
      Serial.print("Sensor 5 fez medição ");
      Serial.print(b);
      Serial.print(" como temperatura");
      Serial.print(EEPROM.read(b));
      Serial.println (temp5);
      b++;


    }
    estadocircuito = 3;
  }

  if (estadocircuito == 3) {
    EEPROM.format();
    digitalWrite (PC13, HIGH);
    delay(2000);
    estadocircuito = 0;
  }


}
This is my code, i don't know what i can do.

stevestrong
Posts: 390
Joined: Fri Dec 27, 2019 4:53 pm
Answers: 7
Location: Munich, Germany
Contact:

Re: How to access Roger's libraries

Post by stevestrong »

The EEPROM library is only suitable to store couple of data, up to 500 bytes.
For many kBytes you have to use compete FLASH pages to store data.
For that I recommend to study how data is written into the flash by differnt bootloaders (DFU, HID, CDC).

GonzoG
Posts: 81
Joined: Wed Jan 15, 2020 11:30 am
Answers: 5

Re: How to access Roger's libraries

Post by GonzoG »

If you want that much data in EEPROM consider using external I2C/SPI EEPROM.
STM32F1 does not have hardware EEPROM and STM core and Roger's core use software emulation in FLASH memory. It's really destructive for the FLASH as it writes/erases whole flash page with every write.

mrburnette
Posts: 314
Joined: Thu Dec 19, 2019 1:23 am
Answers: 1

Re: How to access Roger's libraries

Post by mrburnette »


FerroFerido
Posts: 12
Joined: Tue Nov 17, 2020 11:10 pm

Re: How to access Roger's libraries

Post by FerroFerido »

stevestrong wrote:
Mon Nov 23, 2020 11:44 pm
The EEPROM library is only suitable to store couple of data, up to 500 bytes.
For many kBytes you have to use compete FLASH pages to store data.
For that I recommend to study how data is written into the flash by differnt bootloaders (DFU, HID, CDC).
I don't know where to start

FerroFerido
Posts: 12
Joined: Tue Nov 17, 2020 11:10 pm

Re: How to access Roger's libraries

Post by FerroFerido »

GonzoG wrote:
Tue Nov 24, 2020 1:44 am
If you want that much data in EEPROM consider using external I2C/SPI EEPROM.
STM32F1 does not have hardware EEPROM and STM core and Roger's core use software emulation in FLASH memory. It's really destructive for the FLASH as it writes/erases whole flash page with every write.
Good Idea man

fredbox
Posts: 97
Joined: Thu Dec 19, 2019 3:05 am
Answers: 2

Re: How to access Roger's libraries

Post by fredbox »

24C256 modules are cheap and available from the usual sources. This gives you 32K of EEPROM to use as you see fit. There are libraries that support these devices, although basic read/write is easy enough that you can access the part directly without any extra libraries. See http://www.learningaboutelectronics.com ... rduino.php for an example.

Post Reply

Return to “IDE's”