avr-libc-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-libc-dev] 2.0.0 and XMega32E5 eeprom troubles...


From: Scott Price
Subject: Re: [avr-libc-dev] 2.0.0 and XMega32E5 eeprom troubles...
Date: Wed, 10 Feb 2016 08:34:24 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0

On 02/10/2016 02:13 AM, Sivanupandi, Pitchumani wrote:
-----Original Message-----
From: address@hidden [mailto:avr-
address@hidden On Behalf Of Scott Price
Sent: 10 February 2016 00:54
To: address@hidden
Subject: [avr-libc-dev] 2.0.0 and XMega32E5 eeprom troubles...


I am not able to get any of the eeprom_write_* or eeprom_update_* functions
working on an XMega32E5.  There are no compile errors or warnings, the
functions just don't do anything.  The eeprom read functions that I am using
all work fine.

I had previously been using a version of avr-libc that I lifted from
AVRStudio 6.2 to get support for the E5.  The eeprom functions worked well
on that version.

I compiled it using gcc-4.9.3 on Ubuntu Trusty.

Atmel's nvm functions work for me, but add a significant amount of code.
   I would rather use the ones from avr-libc, since I use them for all of my
other AVR projects.

Looking through the code and the docs it seems like the functions should
work.

I have done a number of experiments, including writing a fixed value to a
fixed location on boot then reading the eeprom out with avr-dude.
Nothing I have done has produced a successful write.

What more information do you need, or what tests can I run to help debug
this?

Hi Scott,

If you are building avr-libc, could you try below patch?
This is the related difference I could see from Atmel's avr-libc build.

Regards,
Pitchumani

diff --git a/avr-libc/libc/misc/eewr_byte.S b/avr-libc/libc/misc/eewr_byte.S
index 98008c2..30b1595 100644
--- a/avr-libc/libc/misc/eewr_byte.S
+++ b/avr-libc/libc/misc/eewr_byte.S
@@ -61,6 +61,12 @@ ENTRY        eeprom_write_r18
  #  define NVM_CMD_ERASE_EEPROM_BUFFER_gc       0x36
  # endif

+#if    ! defined (NVM_EEMAPEN_bm)
+  ; Saving X register because it might contain source address of block
+    push XL
+    push XH
+#endif
+
    ; Prepare base address of NVM.
         ldi     ZL, lo8(NVM_BASE)
         ldi     ZH, hi8(NVM_BASE)
@@ -136,6 +142,12 @@ ENTRY      eeprom_write_r18
    ; Increment address.
         adiw    addr_lo, 1

+#if    ! defined (NVM_EEMAPEN_bm)
+  ; Restoring X register
+    pop XH
+    pop XL
+#endif
+
         ret

  #else          /* ---------------------------------------------------- */


_______________________________________________
AVR-libc-dev mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/avr-libc-dev


That gives me the same result. No warnings or errors, it just does nothing. It is like it is not getting called or compiled in. The map file from gcc says it is taking up 0x46 bytes of memory in .text.avr-libc, so it is getting compiled in.

After hacking around some, I found the patch below makes it work for me. Granted, it is not a good solution, as it probably breaks things for all other XMegas. ;) I am only using the E5 currently.

Thanks!

Scott =)


--- eewr_byte.S.orig 2016-02-10 08:22:16.373013183 -0600
+++ eewr_byte.S 2016-02-10 08:28:46.638860509 -0600
@@ -116,7 +116,7 @@
std Z + NVM_ADDR0 - NVM_BASE, addr_lo
std Z + NVM_ADDR1 - NVM_BASE, addr_hi
std Z + NVM_ADDR2 - NVM_BASE, __zero_reg__
-#if defined (NVM_EEMAPEN_bm)
+#if !defined (NVM_EEMAPEN_bm)
std Z + NVM_DATA0 - NVM_BASE, r18
#else
movw XL, addr_lo




--
Scott L. Price, P.E.
Electrical Engineering/IT Manager
Hunt Utilities Group LLC                     http://www.hugllc.com
Pine River, MN                               (218) 587-5001
MN Electrical Licenses:  Master #AM08525  Power Limited #PL11071



reply via email to

[Prev in Thread] Current Thread [Next in Thread]