LPC1343 (IAP Read Part Identification command)

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

LPC1343 (IAP Read Part Identification command)

939件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Andrew on Mon Sep 17 19:45:20 MST 2012
Hi there,

   For some reasons when I call (IAP Read Part Identification command) (Command code: 54 (decimal)) the return code is not CMD_SUCCESS even though the result is correct (Device id is 0x3D00002B). I don't have any problems with other IAP commands. Couldn't find any info in the Internet and errata doesn't mention it either.
   Did any one face similar problem before? What is the solution?

Cheers,
Andrew
0 件の賞賛
返信
5 返答(返信)

910件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by ex-kayoda on Tue Sep 18 15:28:27 MST 2012

Quote: Andrew
Why not? :)



Answer this question yourself :p

Is a flash_cmd_t structure with in and out structure (without union = same memory location) working?
0 件の賞賛
返信

910件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Andrew on Tue Sep 18 14:54:42 MST 2012
Why not? :) The following information is from the user manual:

For in application programming the IAP routine should be called with a word pointer in register r0 pointing to memory (RAM) containing command code and parameters. Result of the IAP command is returned in the result table pointed to by register r1. [COLOR=Red]The user can reuse the command table for result by passing the same pointer in registers r0 and r1.[/COLOR]

Union is just a nice way to access results and pass parameters.
It has exactly the same size as uint32_t p_array[5];
0 件の賞賛
返信

910件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by ex-kayoda on Tue Sep 18 03:32:34 MST 2012
Why are you using an UNION :confused:
0 件の賞賛
返信

910件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Andrew on Tue Sep 18 01:45:09 MST 2012
Exactly the same as Command code: 54 (decimal). I am using same pointer for in and out parameters, as follows:

#define IAP_LOCATION                                (0x1fff1ff1UL)

typedef union
{
    struct
    {
        uint32_t cmd;
        uint32_t param[4];
    } in;
    struct
    {
        uint32_t status;
        uint32_t result[4];
    } out;
} flash_cmd_t;

typedef void (*iap_t)(flash_cmd_t *cmd_arg, flash_cmd_t *status_arg);

static const iap_t iap_entry                   = (iap_t)IAP_LOCATION;
static flash_cmd_t flash_params;

    flash_params.in.cmd = 54;
    iap_entry(&flash_params, &flash_params);

    if (flash_params.out.status == 0) //status should be zero, but it's actually 54
    {
    ret_id = flash_params.out.result[0];// even though this value is correct
    }
0 件の賞賛
返信

910件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by ex-kayoda on Mon Sep 17 20:37:36 MST 2012

Quote: Andrew
...the return code is not CMD_SUCCESS...



Which status code is returned  :confused:
0 件の賞賛
返信