Abstract EEPROM access

This forum is dedicated to feedback, discussions about ongoing or future developments, ideas and suggestions regarding the ChibiOS projects are welcome. This forum is NOT for support.
trunet
Posts: 54
Joined: Fri Apr 06, 2012 7:18 pm

Re: Abstract EEPROM access

Post by trunet »

Giovanni wrote:Note that higher numbers are lower priorities so you did the exact opposite. Try an I2C priority set to 5 and see if it makes a difference.

I tried with 1, 3, 5, 8, 10 and 13 and none works.

barthess wrote:I do not know how to libmaple does, but I would insert short sleeps in outln() to give some time to UART to printout messages from buffer.

this helps my serial communication problems.

but, it's freezing now. it reads the first EEPROM value but than it freezes on the loop. sleeps does not help either.

Code: Select all

Trunetcopter
EEPROM Write...
Altitude:000000
Pressure:062529
Temperature:064591
EEPROM Read...
AQUI1
AQUI2
AQUI3
AQUI4
000 AQUI1
AQUI2


last code: http://github.com/trunet/trunetcopter
User avatar
Giovanni
Site Admin
Posts: 14893
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: Abstract EEPROM access

Post by Giovanni »

Using the default settings the usable priorities go from 2 to 15, 0 and 1 are reserved for "fast interrupts" and must not be used by normal device drivers.

The only obvious problem with your code is that you return from the main() function, returning from the main() stops the system into an infinite loop, see the startup file crt0.c. If you don't need the main() thread then you should enter a loop with a chThdSleepMilliseconds(1000) inside instead.

Anyway, you definitely need a JTAG/SWD probe if you are going to develop something complex, even a STM32xx-Discovery board could do that and you can have them for few $ or even for free.

Giovanni
trunet
Posts: 54
Joined: Fri Apr 06, 2012 7:18 pm

Re: Abstract EEPROM access

Post by trunet »

Giovanni wrote:Using the default settings the usable priorities go from 2 to 15, 0 and 1 are reserved for "fast interrupts" and must not be used by normal device drivers.

The only obvious problem with your code is that you return from the main() function, returning from the main() stops the system into an infinite loop, see the startup file crt0.c. If you don't need the main() thread then you should enter a loop with a chThdSleepMilliseconds(1000) inside instead.

Anyway, you definitely need a JTAG/SWD probe if you are going to develop something complex, even a STM32xx-Discovery board could do that and you can have them for few $ or even for free.

I just returned from main() because of compiler warnings.

The hackerspace I'm member here(I'm in Brazil) have a JATG. I'm going there next week to see what's happening. Thanks for your time and patience I'll be back further.
jwblanski
Posts: 1
Joined: Sun Apr 28, 2013 12:02 pm

Re: Abstract EEPROM access

Post by jwblanski »

Hello, I'm also trying to access the EEPROM AT24LC256 with a processor SMT32F103. Has a detail that should be taken into consideration.
Examples of códio are provided by ST to memory 24C08, which the access address is 8 bits. To connect 24C256 memory is required to send a 16-bit address. I still can not configure the I2C peripheral address for the STM32F103 by 16 bits. Have you ever got? If you could, I would be very grateful if you could send me the code. ([email protected]). Thank you.
If you want I make a code to read BMP images in SD card and show the photos on display.
User avatar
barthess
Posts: 861
Joined: Wed Dec 08, 2010 7:55 pm
Been thanked: 7 times

Re: Abstract EEPROM access

Post by barthess »

jwblanski wrote:I still can not configure the I2C peripheral address for the STM32F103 by 16 bits.

You can not. 16-bit is address of byte inside EEPROM storage array. Address of AT24LC256 on bus is 8-bit.
max_xxv
Posts: 5
Joined: Mon Oct 28, 2013 10:45 am

Re: Abstract EEPROM access

Post by max_xxv »

Hi,
I'm newbie of Chibios, I've tested thread, PWM, interrupt usage and now I need to dialog with 24LC256 EEPROM. Have you a project that I can use as reference to see bathess eeprom implementation?

I've read README in downloaded file from https://github.com/barthess/24aa but I've some dubt on main.c structure, include file and Makefile configuration, can you help me?

Best regards
max_xxv ( Mauro )
User avatar
barthess
Posts: 861
Joined: Wed Dec 08, 2010 7:55 pm
Been thanked: 7 times

Re: Abstract EEPROM access

Post by barthess »

max_xxv wrote:but I've some dubt on main.c structure

The simplest example I have is https://github.com/barthess/eeprom_burn
Just delete all USBSerial stuff.
max_xxv wrote:Makefile configuration

just add 24aa.c and eeprom.c to CSRC variable

P.S. I would recommend C++ variant of this library because C variant
is slightly outdated and currently is not supported any more.
max_xxv
Posts: 5
Joined: Mon Oct 28, 2013 10:45 am

Re: Abstract EEPROM access

Post by max_xxv »

ok, eeprom_burn-master is clear, I like it :)

But I've a problem with eeprom function and my ATM32F407 IC, I've some error on part of code like this:

Code: Select all

  eeprom_cycle = BKP->DR1;
  eeprom_cycle = eeprom_cycle << 16;
  eeprom_cycle += BKP->DR2;


I've commented this part of code for test...

Now I've a problem on this row:

Code: Select all

      chFileStreamSeek(&EepromFile, 0);


debug jump on :

Code: Select all

void _unhandled_exception(void) {

  while (TRUE)
    ;
}



Obviously I've placed

Code: Select all

/* mounted EEPROM */
EepromFileStream EepromFile;
in my code :)
User avatar
barthess
Posts: 861
Joined: Wed Dec 08, 2010 7:55 pm
Been thanked: 7 times

Re: Abstract EEPROM access

Post by barthess »

max_xxv wrote:void _unhandled_exception(void)

This almost always caused by incorrect pointer handling somewhere.
max_xxv
Posts: 5
Joined: Mon Oct 28, 2013 10:45 am

Re: Abstract EEPROM access

Post by max_xxv »

ok, but in my code there isn't more than inclusion of your code :)

Have you never used it on STM32F4 MCU?
Post Reply