本帖最后由 小恩GG 于 2019-3-11 10:13 编辑
小惊喜 在这之前小编已分享过两篇关于Reinvoke ISP调用过程中碰到问题的经验分享,还没看过的小伙伴,“请出门左拐去看一下”,文章标题分别是 :《ISP“二进宫”问题》及 《ISP“二进宫”问题(后续)》,而本期的话题也是关于Reinvoke ISP指令的,但是这次的主角MCU换成了LPC54608. 开宗明义完后,正式进入本期话题讨论。 在客户的设备中,LPC54608的USB0接口已被占用,而且按照图1所示,LPC54608中的Reinvoke ISP并不支持MCU从application运行状态进入到USB1 ISP模式。 图 1
但人生有时幸福来得往往很突然,正如《阿甘正传》里的台词说的那样:“ 生活就像一盒巧克力,你永远不知道下一块会是什么味道。”其实LPC54608中的Reinvoke ISP是支持进入USB1 ISP模式的,具体测试过程如下,并且经验证,LPC54628也是支持的。 1. 代码准备(例程iap_basic来自SDK_2.5.0_LPCXpresso54608) - /*!
- * brief Reinvoke ISP
- * This function is used to invoke the boot loader in ISP mode. It maps boot vectors and configures the
- * peripherals for ISP.
- *
- * param ispTyoe ISP type selection.
- * param status store the possible status
- *
- * retval #kStatus_IAP_ReinvokeISPConfig reinvoke configuration error.
- * note The error response is returned if IAP is disabled, or if there is an invalid ISP type selection. When
- * there is no error the call does not return, so there can be no status code.
- */
- void IAP_ReinvokeISP(uint8_t ispType, uint32_t *status)
- {
- uint32_t command[5], result[5];
- uint8_t ispParameterArray[8];
- command[0] = kIapCmd_IAP_ReinvokeISP;
- memset(ispParameterArray, 0, sizeof(uint8_t) * 8);
- ispParameterArray[1] = ispType;
- ispParameterArray[7] = ispParameterArray[0] ^ ispParameterArray[1] ^ ispParameterArray[2] ^ ispParameterArray[3] ^
- ispParameterArray[4] ^ ispParameterArray[5] ^ ispParameterArray[6];
- command[1] = (uint32_t)ispParameterArray;
- iap_entry(command, result);
- *status = translate_iap_status(result[0]);
- }
- #函数中第二个参数取9,
- #在函数调用后LPC54608就将进入USB1 ISP 模式。
- IAP_ReinvokeISP(0x9,&status);
- if (status != kStatus_IAP_Success)
- {
- PRINTF("\r\nReinvoke ISP not successful\r\n");
- }
复制代码 2. 硬件设置 USB口需要提前连接(在调用 IAP_ReinvokeISP函数之前),如图2所示。 图 2LPC54608 开发板
3. CRP “硬盘” 图3CRP“硬盘”
|