I have the following code so I can restart the ISP and re-write flash after I have loaded valid application.
My code is
uint32_t res_status; //
const uint32_t USART_ISP_1 = 1;
IAP_ReinvokeISP(USART_ISP_1, &res_status);
UM11064
Command code: 57 (decimal)
Param0(mode): ISP interface selection
1 - USART ISP <----- apparently this means that the constant 1 is the only valid parameter?
IAP_ReinvokeISP on my MCUXpresso the #define FSL_FEATURE_SYSCON_IAP_REINVOKE_ISP_PARAM_POINTER is not defined so the IAP_ISP_TYPE_XXX ##defines have no effect on the IDE supplied wrapper function (IAP_ReinvokeISP).
When I break point to one past this command I get the following error.
----
Break at address "0xdeadbeee" with no debug information available, or outside of program code.
----
What else does this command need?
Solved! Go to Solution.
Tried to invalidate the checksum at VTOR[7] based on the following statement from UM11065 with the following code:
uint32_t shadow_vector[16];
memcpy (shadow_vector, (uint8_t)0, 64 );
shadow_vector[7] = 0xffffffff;
IAP_PrepareSectorForWrite( 0 , 0); // prepare sector 0 for write
volatile status_t res2 =
// dst src num clk
IAP_CopyRamToFlash ( 0, shadow_vector, 64, SystemCoreClock );
but break pointing beyond this (and before the IAP_ReinvokeISP call).
the reading the memory tab at location 0 shows the values unchanged. (reasonable since they were not erased first.)
but previous attempts to erase the memory (64 bytes starting at address 0, with prep first) resulted in a FFFFFFF9 error.
Tried to invalidate the checksum at VTOR[7] based on the following statement from UM11065 with the following code:
uint32_t shadow_vector[16];
memcpy (shadow_vector, (uint8_t)0, 64 );
shadow_vector[7] = 0xffffffff;
IAP_PrepareSectorForWrite( 0 , 0); // prepare sector 0 for write
volatile status_t res2 =
// dst src num clk
IAP_CopyRamToFlash ( 0, shadow_vector, 64, SystemCoreClock );
but break pointing beyond this (and before the IAP_ReinvokeISP call).
the reading the memory tab at location 0 shows the values unchanged. (reasonable since they were not erased first.)
but previous attempts to erase the memory (64 bytes starting at address 0, with prep first) resulted in a FFFFFFF9 error.
We can break point before the
iap_entry(command, result);
call, but not after it (as expected). but
-- it does not respond to ISP commands
-- it does not respond to IDE debugger pause button
-- it *does* respond to *application* USART0 commands as if it restarted the embedded code and did not stay in the ISP code
hhhmmm...
// set these to reset values per UM11065 4.6.8
SYSCON_MAINCLKSEL_SEL(0);
SYSCON_MAINCLKUEN_ENA(0);
SYSCON_SYSAHBCLKDIV_DIV(1);
I added these lines to match the reset values defined for the clock registers in UM11065 LPC804 User Manual.
This stopped the DEADBEEE, breakpoint, and breakpoints after the call don't occur (which is correct behavior)
but we are not able to get an ISP response on the USART0.
The UM11065 Table 35 (4.6.8) only mentions USART ISP, but not which USART. we are using USART0.
I noticed that with my LPC804UK the "FSL_FEATURE_SYSCON_IAP_REINVOKE_ISP_PARAM_POINTER" is not enabled, so so all the IAP_ISP_TYPE_I2C style choices are not available for the ispType parameter. Likely because they are not available for this chip.