LPC845 a documentation issue or IAP ROM issue

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

LPC845 a documentation issue or IAP ROM issue

Jump to solution
1,362 Views
rodboyce
Contributor I

I have been working with the LPCXpresso845MAX board and discovered an issue interfacing to the IAP ROM routines.  Following the User manual UM11029 Rev 1.6 in section 5.6 the sentence in opening paragraph says 'The user can reuse the command table for result by passing the same pointer in registers r0 and r1.'.  When doing this I was continuing to get INVALID_COMMAND returned.  

But if I do not use the same buffers for input and output then the command succeed. Reading through these forums this appears to be similar to an issue reported on the LPC824.

So my question becomes is this a User manual documentation issue or a boot ROM issue and will be fixed in a furture variant of the micro-controller?

Labels (1)
0 Kudos
1 Solution
953 Views
kerryzhou
NXP TechSupport
NXP TechSupport

You and Werner Fritsch are right, the doc really have problems, thank you very much for the reporting.

I will report the bug to our internal department.

Thanks again for your contribution.


Have a great day,
Kerry

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

View solution in original post

0 Kudos
6 Replies
953 Views
rodboyce
Contributor I

The link to the issue with the LPC824 is here https://community.nxp.com/thread/433541  

0 Kudos
954 Views
kerryzhou
NXP TechSupport
NXP TechSupport

You and Werner Fritsch are right, the doc really have problems, thank you very much for the reporting.

I will report the bug to our internal department.

Thanks again for your contribution.


Have a great day,
Kerry

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
953 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Rod Boyce,

    Could you also share your test project for IAP ROM issue? I will help you to check it.

   Actually, in our code bundle code, it also use the same buffers, it doesn't have problem. If you have time, you also can try our flash_IAP project, which can be downloaded from this link:

LPC84x 30MHz|Arm® Cortex®-M0+|32-bit Microcontrollers (MCUs)|NXP 

Under Lab and Test Software

You mentioned, there also have a similar post about LPC824, please also share the link. I will check it at first.


Have a great day,
Kerry

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
953 Views
rodboyce
Contributor I

Sir,

Just looking at your code the IAP structure declares a different set of pointers for the send buffers and the reply buffers:

struct sIAP
{
uint32_t cmd; // Command
uint32_t par[4]; // Parameters
uint32_t stat; // Status
uint32_t res[4]; // Result
};

Your IAP call function then passes pointers to the cmd and the state elements in this structure:
IAP_Call (&IAP.cmd, &IAP.stat); // Call IAP Command

This does not use the same buffers for send and receive IAP commands.

I will post my code in the next reply.

Rod

0 Kudos
953 Views
rodboyce
Contributor I

My test code does the following:

ssize_t IapEntry( size_t p1, size_t p2, size_t p3, size_t p4 )
{
typedef void (*IAP)(uint32_t*, uint32_t*);
IAP IAP_ENTRY = ((IAP)0x0F001FF1);
uint32_t buf[ 5 ] = {p1,p2,p3,p4, 0};

if(( p1 < 50 ) || ( p1 > 81 ))
{
buf[ 0 ] = 57;
}

MonitorWriteVar( STR_TO_VAR( 'c', 'm', 'd', '0' ), buf[ 0 ]);
MonitorWriteVar( STR_TO_VAR( 'c', 'm', 'd', '1' ), buf[ 1 ]);
MonitorWriteVar( STR_TO_VAR( 'c', 'm', 'd', '2' ), buf[ 2 ]);
MonitorWriteVar( STR_TO_VAR( 'c', 'm', 'd', '3' ), buf[ 3 ]);

IAP_ENTRY( buf, buf );

MonitorWriteVar( STR_TO_VAR( 'r', 't', 'n', 'v'), buf[ 0 ]);
MonitorWriteVar( STR_TO_VAR( 'r', 's', 'l', '0'), buf[ 1 ]);
MonitorWriteVar( STR_TO_VAR( 'r', 's', 'l', '1'), buf[ 2 ]);
MonitorWriteVar( STR_TO_VAR( 'r', 's', 'l', '2'), buf[ 3 ]);
MonitorWriteVar( STR_TO_VAR( 'r', 's', 'l', '3'), buf[ 4 ]);

return 0;
}

The same pointer is passed to the send and receive pointer in the IAP_ENTRY function.  This will return an invalid IAP command status.   

0 Kudos
953 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Rod Boyce,

    Thank you very much for your effort and the careful testing.

    Sorry for my later reply, because a lot of cases need to do the test in the queue.

  Today, I have test the doc description, with the same point :

pastedImage_1.png

For meet the big enough demand, I define the code like this in the codebundle IAP example, mainly test ErasePage API:

int ErasePage_KERRY (uint32_t adr)
{
  uint32_t n;
   uint32_t buf[ 10 ];//kerry
   
  n = GetSecNum(adr);                          // Get Sector Number
//=======kerry_begin=========
  buf[0] = IAP_PREPARE;
  buf[1] = n;
  buf[2] = n;
  buf[3] = 0;    
  buf[4] = 0;    
  buf[5] = 0;    
  buf[6] = 0; 
  buf[7] = 0;   
  buf[8] = 0;     
  buf[9] = 0;  
  
  IAP_Call (buf, buf);              // Call IAP Command
  //IAP_Call (buf, &buf[5]);              // Call IAP Command
  if(buf[5]) return (buf[5]);             // Command Failed
 //===========kerry_end========== 
  IAP.cmd    = IAP_PREPARE;                    // Prepare Sector for Erase
  IAP.par[0] = n;                              // Start Sector
  IAP.par[1] = n;                              // End Sector
  IAP_Call (&IAP.cmd, &IAP.stat);              // Call IAP Command
  if (IAP.stat) return (IAP.stat);             // Command Failed

  n = adr >> 6;                                // Get Page Number, 64 bytes/page

  IAP.cmd    = IAP_ERASE_PAGE;                 // Erase Page
  IAP.par[0] = n;                              // Start page
  IAP.par[1] = n;                              // End page
//  IAP.par[2] = SystemCoreClock / 1000;         // CCLK in kHz
  IAP_Call (&IAP.cmd, &IAP.stat);              // Call IAP Command
  if (IAP.stat) return (IAP.stat);             // Command Failed

  return (0);                                  // Finished without Errors
}‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

Then the test result like this:

1. before call the IAP_Call(buf,buf), with the same point:

pastedImage_2.png

2. after call the IAP_Call(buf,buf), with the same pointer:

pastedImage_3.png

The returned value is wrong, I think this 0x01 should be the status, although I judge buf[5].

Then Run the code with different pointer:

pastedImage_4.png

So, the result just like what you have side, it should be the doc problem,it can't use the same pointer.

I think that's why official code also use different pointer.

Don't worry, I will report it to our according department, they help to update the doc in the next version.

Thank you and Werner Fritsch, they help us make the doc better! Smiley Happy


Have a great day,
Kerry

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos