AT90CAN128, GCC und EEPROM

OP #265999
Lesenswert?

Progrmmiere eben meinen CAN128 mit dem GCC. Leider sind die
vorgefertigten EEPROM Routinen ja nicht verwendbar (oder doch
irgendwie?). Nunja hab mir meine eigene Lese- und  Schriebroutine
gebastelt, nur muss ich nun feststellen, dass nichts im EEPROM
geschriben wird.
Hab mich dazu an das Beispiel auf Seite 24 des Datenblatts gehalten und

...
EECR |= (1<<EEMWE);
EECR |= (1<<EEWE);
implementiert.

So geht es aber nicht!
Hab festgestellt, das der GCC daraus macht:

lds R24, 0x003F
ori R24, 0x04
sts 0x003F, R24
lds R24, 0x003F
ori R24, 0x02
sts 0x003F, R24

Es gibt ja die Einschränkung mit den 4 Takten nach dem Setzen von
EEMWE, offensichtlich stört dies aber den GCC nicht - was kann ich nun
machen das ich (in C) dieses Bit schnell genug gesetz bekomme?
Oder muss ein inline Assebler ran?
OP #266001
Lesenswert?

Aus der Doku zu AVR-LIBC:
Detailed Description
 #include <avr/eeprom.h>

This header file declares the interface to some simple library routines
suitable for handling the data EEPROM contained in the AVR
microcontrollers. The implementation uses a simple polled mode
interface. Applications that require interrupt-controlled EEPROM access
to ensure that no time will be wasted in spinloops will have to deploy
their own implementation.


Note:
All of the read/write functions first make sure the EEPROM is ready to
be accessed. Since this may cause long delays if a write operation is
still pending, time-critical applications should first poll the EEPROM
e. g. using eeprom_is_ready() before attempting any actual I/O.
This library will not work with the following devices since these
devices have the EEPROM IO ports at different locations:

AT90CAN128
ATmega48
ATmega88
ATmega165
ATmega168
ATmega169
ATmega325
ATmega3250
ATmega645
ATmega6450

Antwort schreiben

Bitte melde dich an, um einen Beitrag zu schreiben.

oder

Mit Google-Account einloggen

Die Registrierung ist kostenlos und dauert nur eine Minute.

Jetzt registrieren