bugAVR C Runtime Library - Bugs: bug #27198, avr/iox128a1.h is missing...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #27198: avr/iox128a1.h is missing definitions for calibration signature indexes

Submitter:  Simon Kueppers <simonk>
Submitted:  Fri 07 Aug 2009 01:27:14 AM UTC
   
 
Category:  Header Severity:  3 - Normal
Priority:  9 - Immediate Item Group:  Header files
Status:  None Assigned to:  None
Percent Complete:  0% Open/Closed:  Open
Release:  1.7.* Fixed Release:  None

Fri 07 Aug 2009 11:24:23 AM UTC, comment #4: 

Maybe this one is better. It works fine as far as I can test it (Just reading LOTNUM3).

See signaturerow2.txt

(file #18537)

Simon Kueppers <simonk>
Fri 07 Aug 2009 11:05:19 AM UTC, comment #3: 

First, as I already said Im not so much into inline-assembler.

What comes to the nt's I don't know who converted it from \n\t to nt on the long way of copy and pasting. In the text file it's correct.

I also haven't found a way to use ZH/ZL instead of r30, r31.

In this line
"ldi %[Idx], %[Rd]"
I just needed a temporary Register to copy the NVM_CMD_READ_CALIB_ROW_gc. So i used this register. I almost believe that there is a better solution, which is easier to understand.

The constraints I got from a German page (http://www.rn-wissen.de/index.php/Inline-Assembler_in_avr-gcc).
It says "r" for any register, M for an 8 Bit Constant, m for a memory address (I believe?) and d for an upper register. So I think anything should be fine, but Im open to tips or hints.

I've already tested the assembly within the attached text-file and it works so far. I can read all calibration row entries.

Simon Kueppers <simonk>
Fri 07 Aug 2009 01:38:04 AM UTC, comment #2: 

Yes Z (r30,r31) would have to be clobbered.

You have to change your "nt" to "\n\t" to truly get newline and tab characters.

I have doubts about this line:
"ldi %[Idx], %[Rd]" "nt"
I'm not sure what you're trying to do there.

And you probably need to double check your constraints that you're using.

But the work that you've done so far is very appreciated! :-) Would you be willing to keep working on the inline assembly and get it working and tested? You can look at other inline assembly constructs in avr-libc for working examples.


Eric Weddington <arcanum>
Group administrator
Fri 07 Aug 2009 01:31:34 AM UTC, comment #1: 

Maybe r30 and r31 have to get clobbered. Im not so much into inline-assembler.
I also appended the code as a text file.

(file #18535)

Simon Kueppers <simonk>
Fri 07 Aug 2009 01:27:14 AM UTC, original submission:  

There are no #defines or enums defining an index for each possible production/calibration signature row entry/register.
This index has to be loaded into ZL when using LPM on the NVM to load production signature entries.

It could look like:

typedef enum NVM_PROD_SIG_IDX_enum
{
NVM_PROD_SIG_IDX_RCOSC2M = 0x00,
NVM_PROD_SIG_IDX_RCOSC32K = 0x02,
NVM_PROD_SIG_IDX_RCOSC32M = 0x03,
NVM_PROD_SIG_IDX_LOTNUM0 = 0x08,
NVM_PROD_SIG_IDX_LOTNUM1 = 0x09,
NVM_PROD_SIG_IDX_LOTNUM2 = 0x0A,
NVM_PROD_SIG_IDX_LOTNUM3 = 0x0B,
NVM_PROD_SIG_IDX_LOTNUM4 = 0x0C,
NVM_PROD_SIG_IDX_LOTNUM5 = 0x0D,
NVM_PROD_SIG_IDX_WAFNUM = 0x10,
NVM_PROD_SIG_IDX_COORDX0 = 0x12,
NVM_PROD_SIG_IDX_COORDX1 = 0x13,
NVM_PROD_SIG_IDX_COORDY0 = 0x14,
NVM_PROD_SIG_IDX_COORDY1 = 0x15,
NVM_PROD_SIG_IDX_ADCACAL0 = 0x20,
NVM_PROD_SIG_IDX_ADCACAL1 = 0x21,
NVM_PROD_SIG_IDX_ADCBCAL0 = 0x24,
NVM_PROD_SIG_IDX_ADCBCAL1 = 0x25,
NVM_PROD_SIG_IDX_TEMPSENSE0 = 0x2E,
NVM_PROD_SIG_IDX_TEMPSENSE1 = 0x2F,
NVM_PROD_SIG_IDX_DACAOFFCAL = 0x30,
NVM_PROD_SIG_IDX_DACAINCAL = 0x31,
NVM_PROD_SIG_IDX_DACBOFFCAL = 0x32,
NVM_PROD_SIG_IDX_DACBINCAL = 0x33
} NVM_PROD_SIG_IDX_t

a function for reading the signature data could look like:
/* static inline */
uint8_t SystemReadCalibrationByte(NVM_PROD_SIG_IDX_t Index)
{
uint8_t Result;

_asm_ volatile (
"mov r30, %[Idx]" "nt"
"ldi r31, 0" "nt"
"ldi %[Idx], %[Rd]" "nt"
"sts %[Cmd], %[Idx]" "nt"
"lpm %[Res], Z" "nt"
: [Res] "=r" (Result)
: [Idx] "a" ((uint8_t) Index),
  [Rd]  "M" (NVM_CMD_READ_CALIB_ROW_gc),
  [Cmd] "m" (NVM_CMD)
);

return Result;
}

Simon Kueppers <simonk>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attached Files
file #18537:  signaturerow2.txt added by simonk (1KiB - text/plain - updated)
file #18535:  signaturerow.txt added by simonk (1KiB - text/plain)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by arcanum (Posted a comment)
  • -email is unavailable- added by simonk (Submitted the item)
  •  

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2012-11-16 arcanum Priority5 - Normal 9 - Immediate
    2009-08-07 simonk Attached File- Added signaturerow2.txt, #18537
    2009-08-07 simonk Attached File- Added signaturerow.txt, #18535

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code