Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
10/07/03 15:11
Read: times


 
#56259 - at89c5131 builtin flash-api functions
Hi,
I have folowing problem:
When trying to call the builtin api functions of the Atmel AT89C5131 I
get no results - the call simply returns the input values instead of the
requested register values.

The function doing the call is:
---------------------------------------------------
#define MSK_AUXR1_ENBOOT 0x20
#define MAP_BOOT AUXR1 |= MSK_AUXR1_ENBOOT;
#define UNMAP_BOOT AUXR1 &= ~MSK_AUXR1_ENBOOT;

typedef unsigned char Uchar;

Uchar data api_command _at_ 0x1C;
Uchar data api_value _at_ 0x1D;
Uchar data api_dph _at_ 0x1E;
Uchar data api_dpl _at_ 0x1F;

Uchar __api_fct_set_1 (Uchar _R1, Uint16 _DPTR) small
{
bit ea_save;

ea_save = EA;
EA = 0;

api_dph = (_DPTR >> 8);
api_dpl = (_DPTR & 0xFF);
api_command = _R1;
api_value = _R1;
MAP_BOOT;
__API_FLASH_ENTRY_POINT();
UNMAP_BOOT;
EA = ea_save; /* restore interrupt state */
return (api_value);
}
------------------------------------------
calling the assembler function:
-------------------------------------------
__API_FLASH_ENTRY_POINT:
PUSH AR2
PUSH AR4
PUSH AR6
LCALL 0FFF0h
POP AR6
POP AR4
POP AR2
Ret
-------------------------------------------
According to (my interpretation of) Atmel's doc ("AT89C5131 USB
Bootloader") the call should return some configuration and manufacturer
information - e.g.:
manufacturer_code = __api_fct_set_1(5,0x30);

This function's code resulted from a modification of a code sample
supplied by Atmel for the AT89C51RD2 - modified according to differences
in the parameter passing method between the two uCs' bootloader codes.
As mentioned above the call acts like a single return statement leaving
all values unchanged.

What am I doing wrong ?

Thanks for help.
Bernhard




List of 3 messages in thread
TopicAuthorDate
at89c5131 builtin flash-api functions            01/01/70 00:00      
   RE: at89c5131 builtin flash-api functions            01/01/70 00:00      
      RE: at89c5131 builtin flash-api functions            01/01/70 00:00      

Back to Subject List