恩智浦设计知识库

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

NXP Designs Knowledge Base

讨论

排序依据:
If we flash a RD-RW612-BGA binary into FRDM-RW612 the board will be locked, and we will no longer be able to write data into the flash until we unlock it. The reason why it locks is because the Winbond flash on the FRDM board has a lock bit that is enabled when flashing the RD application. Fortunately, there is a way to unlock it with the FlexSPI interface. In this document we will briefly show how to do this. We will modify the frdmrw612_flexspi_nor_dma_tranfer SDK example. We're going to modify app.h, flexspi_nor_flash_ops.c and flexspi_nor_dma_transfer.c.   In app.h we modify/add some macros with the following values:       #define SECTOR_SIZE 0x10000 /* 64K */ #define NOR_CMD_LUT_SEQ_IDX_READ_FAST_QUAD 0 #define NOR_CMD_LUT_SEQ_IDX_WRITESTATUSREG1 1 #define NOR_CMD_LUT_SEQ_IDX_WRITEENABLE 2 #define NOR_CMD_LUT_SEQ_IDX_ERASESECTOR 3 #define NOR_CMD_LUT_SEQ_IDX_WRITESTATUSREG2 4 #define NOR_CMD_LUT_SEQ_IDX_ERASECHIP 5 #define NOR_CMD_LUT_SEQ_IDX_WRITESTATUSREG3 6 #define NOR_CMD_LUT_SEQ_IDX_READ_NORMAL 7 #define NOR_CMD_LUT_SEQ_IDX_READID 8 #define NOR_CMD_LUT_SEQ_IDX_WRITE 9 #define NOR_CMD_LUT_SEQ_IDX_READSTATUSREG1 10 #define NOR_CMD_LUT_SEQ_IDX_READSTATUSREG2 11 #define NOR_CMD_LUT_SEQ_IDX_READSTATUSREG3 12 #define NOR_CMD_LUT_SEQ_IDX_READ_FAST 13 #define NOR_CMD_LUT_SEQ_IDX_ENABLE_RESET 14 #define NOR_CMD_LUT_SEQ_IDX_RESET_DEVICE 15 #define CUSTOM_LUT_LENGTH 64 /* Enable quad and update dummy cycle */ #define FLASH_QUAD_ENABLE 0xC740       Moving to flexspi_nor_flash_ops.c we will add/modify the following parameters: In flexspi_nor_wait_bus_busy(FLEXSPI_Type *base):     flashXfer.seqIndex = NOR_CMD_LUT_SEQ_IDX_READSTATUSREG1;       Right after the previous function we are going to add these new functions:     status_t flexspi_nor_write_status1(FLEXSPI_Type *base, uint8_t status1) { flexspi_transfer_t flashXfer; status_t status; uint32_t writeValue = status1; /* Make sure external flash is not in busy status. */ status = flexspi_nor_wait_bus_busy(base); if (status != kStatus_Success) { return status; } /* Write enable */ status = flexspi_nor_write_enable(base, 0); if (status != kStatus_Success) { return status; } /* Write the status register 1 */ flashXfer.deviceAddress = 0; flashXfer.port = FLASH_PORT; flashXfer.cmdType = kFLEXSPI_Write; flashXfer.SeqNumber = 1; flashXfer.seqIndex = NOR_CMD_LUT_SEQ_IDX_WRITESTATUSREG1; flashXfer.data = &writeValue; flashXfer.dataSize = 1; status = FLEXSPI_TransferBlocking(base, &flashXfer); if (status != kStatus_Success) { return status; } status = flexspi_nor_wait_bus_busy(base); /* Do software reset. */ #if defined(FSL_FEATURE_SOC_OTFAD_COUNT) && defined(FLEXSPI_AHBCR_CLRAHBRXBUF_MASK) && \ defined(FLEXSPI_AHBCR_CLRAHBTXBUF_MASK) base->AHBCR |= FLEXSPI_AHBCR_CLRAHBRXBUF_MASK | FLEXSPI_AHBCR_CLRAHBTXBUF_MASK; base->AHBCR &= ~(FLEXSPI_AHBCR_CLRAHBRXBUF_MASK | FLEXSPI_AHBCR_CLRAHBTXBUF_MASK); #else FLEXSPI_SoftwareReset(base); #endif return status; } status_t flexspi_nor_write_status2(FLEXSPI_Type *base, uint8_t status2) { flexspi_transfer_t flashXfer; status_t status; uint32_t writeValue = status2; /* Make sure external flash is not in busy status. */ status = flexspi_nor_wait_bus_busy(base); if (status != kStatus_Success) { return status; } /* Write enable */ status = flexspi_nor_write_enable(base, 0); if (status != kStatus_Success) { return status; } /* Write the status register 1 */ flashXfer.deviceAddress = 0; flashXfer.port = FLASH_PORT; flashXfer.cmdType = kFLEXSPI_Write; flashXfer.SeqNumber = 1; flashXfer.seqIndex = NOR_CMD_LUT_SEQ_IDX_WRITESTATUSREG2; flashXfer.data = &writeValue; flashXfer.dataSize = 1; status = FLEXSPI_TransferBlocking(base, &flashXfer); if (status != kStatus_Success) { return status; } status = flexspi_nor_wait_bus_busy(base); /* Do software reset. */ #if defined(FSL_FEATURE_SOC_OTFAD_COUNT) && defined(FLEXSPI_AHBCR_CLRAHBRXBUF_MASK) && \ defined(FLEXSPI_AHBCR_CLRAHBTXBUF_MASK) base->AHBCR |= FLEXSPI_AHBCR_CLRAHBRXBUF_MASK | FLEXSPI_AHBCR_CLRAHBTXBUF_MASK; base->AHBCR &= ~(FLEXSPI_AHBCR_CLRAHBRXBUF_MASK | FLEXSPI_AHBCR_CLRAHBTXBUF_MASK); #else FLEXSPI_SoftwareReset(base); #endif return status; } status_t flexspi_nor_write_status3(FLEXSPI_Type *base, uint8_t status3) { flexspi_transfer_t flashXfer; status_t status; uint32_t writeValue = status3; /* Make sure external flash is not in busy status. */ status = flexspi_nor_wait_bus_busy(base); if (status != kStatus_Success) { return status; } /* Write enable */ status = flexspi_nor_write_enable(base, 0); if (status != kStatus_Success) { return status; } /* Write the status register 1 */ flashXfer.deviceAddress = 0; flashXfer.port = FLASH_PORT; flashXfer.cmdType = kFLEXSPI_Write; flashXfer.SeqNumber = 1; flashXfer.seqIndex = NOR_CMD_LUT_SEQ_IDX_WRITESTATUSREG3; flashXfer.data = &writeValue; flashXfer.dataSize = 1; status = FLEXSPI_TransferBlocking(base, &flashXfer); if (status != kStatus_Success) { return status; } status = flexspi_nor_wait_bus_busy(base); /* Do software reset. */ #if defined(FSL_FEATURE_SOC_OTFAD_COUNT) && defined(FLEXSPI_AHBCR_CLRAHBRXBUF_MASK) && \ defined(FLEXSPI_AHBCR_CLRAHBTXBUF_MASK) base->AHBCR |= FLEXSPI_AHBCR_CLRAHBRXBUF_MASK | FLEXSPI_AHBCR_CLRAHBTXBUF_MASK; base->AHBCR &= ~(FLEXSPI_AHBCR_CLRAHBRXBUF_MASK | FLEXSPI_AHBCR_CLRAHBTXBUF_MASK); #else FLEXSPI_SoftwareReset(base); #endif return status; }   In  status_t flexspi_nor_enable_quad_mode(FLEXSPI_Type *base):     flashXfer.seqIndex = NOR_CMD_LUT_SEQ_IDX_WRITESTATUSREG1;                   Delete status_t flexspi_nor_flash_program(FLEXSPI_Type *base, uint32_t dstAddr, const uint32_t *src, uint32_t length) & status_t flexspi_nor_flash_page_program(FLEXSPI_Type *base, uint32_t dstAddr, const uint32_t *src).     Modify status_t flexspi_nor_get_vendor_id(FLEXSPI_Type *base, uint8_t *vendorId) to:         status_t flexspi_nor_get_vendor_id(FLEXSPI_Type *base, uint8_t *vendorId, uint16_t *deviceId)           Right after status_t flexspi_nor_get_vendor_id(FLEXSPI_Type *base, uint8_t *vendorId, uint16_t *deviceId):         status_t flexspi_nor_get_status1(FLEXSPI_Type *base, uint8_t *status1) { uint32_t temp; flexspi_transfer_t flashXfer; flashXfer.deviceAddress = 0; flashXfer.port = FLASH_PORT; flashXfer.cmdType = kFLEXSPI_Read; flashXfer.SeqNumber = 1; flashXfer.seqIndex = NOR_CMD_LUT_SEQ_IDX_READSTATUSREG1; flashXfer.data = &temp; flashXfer.dataSize = 1; status_t status = FLEXSPI_TransferBlocking(base, &flashXfer); *status1 = temp; /* Do software reset or clear AHB buffer directly. */ #if defined(FSL_FEATURE_SOC_OTFAD_COUNT) && defined(FLEXSPI_AHBCR_CLRAHBRXBUF_MASK) && \ defined(FLEXSPI_AHBCR_CLRAHBTXBUF_MASK) base->AHBCR |= FLEXSPI_AHBCR_CLRAHBRXBUF_MASK | FLEXSPI_AHBCR_CLRAHBTXBUF_MASK; base->AHBCR &= ~(FLEXSPI_AHBCR_CLRAHBRXBUF_MASK | FLEXSPI_AHBCR_CLRAHBTXBUF_MASK); #else FLEXSPI_SoftwareReset(base); #endif return status; } status_t flexspi_nor_get_status2(FLEXSPI_Type *base, uint8_t *status2) { uint32_t temp; flexspi_transfer_t flashXfer; flashXfer.deviceAddress = 0; flashXfer.port = FLASH_PORT; flashXfer.cmdType = kFLEXSPI_Read; flashXfer.SeqNumber = 1; flashXfer.seqIndex = NOR_CMD_LUT_SEQ_IDX_READSTATUSREG2; flashXfer.data = &temp; flashXfer.dataSize = 1; status_t status = FLEXSPI_TransferBlocking(base, &flashXfer); *status2 = temp; /* Do software reset or clear AHB buffer directly. */ #if defined(FSL_FEATURE_SOC_OTFAD_COUNT) && defined(FLEXSPI_AHBCR_CLRAHBRXBUF_MASK) && \ defined(FLEXSPI_AHBCR_CLRAHBTXBUF_MASK) base->AHBCR |= FLEXSPI_AHBCR_CLRAHBRXBUF_MASK | FLEXSPI_AHBCR_CLRAHBTXBUF_MASK; base->AHBCR &= ~(FLEXSPI_AHBCR_CLRAHBRXBUF_MASK | FLEXSPI_AHBCR_CLRAHBTXBUF_MASK); #else FLEXSPI_SoftwareReset(base); #endif return status; } status_t flexspi_nor_get_status3(FLEXSPI_Type *base, uint8_t *status3) { uint32_t temp; flexspi_transfer_t flashXfer; flashXfer.deviceAddress = 0; flashXfer.port = FLASH_PORT; flashXfer.cmdType = kFLEXSPI_Read; flashXfer.SeqNumber = 1; flashXfer.seqIndex = NOR_CMD_LUT_SEQ_IDX_READSTATUSREG3; flashXfer.data = &temp; flashXfer.dataSize = 1; status_t status = FLEXSPI_TransferBlocking(base, &flashXfer); *status3 = temp; /* Do software reset or clear AHB buffer directly. */ #if defined(FSL_FEATURE_SOC_OTFAD_COUNT) && defined(FLEXSPI_AHBCR_CLRAHBRXBUF_MASK) && \ defined(FLEXSPI_AHBCR_CLRAHBTXBUF_MASK) base->AHBCR |= FLEXSPI_AHBCR_CLRAHBRXBUF_MASK | FLEXSPI_AHBCR_CLRAHBTXBUF_MASK; base->AHBCR &= ~(FLEXSPI_AHBCR_CLRAHBRXBUF_MASK | FLEXSPI_AHBCR_CLRAHBTXBUF_MASK); #else FLEXSPI_SoftwareReset(base); #endif return status; }       Add a last function:     status_t flexspi_nor_reset_device(FLEXSPI_Type *base) { status_t status; flexspi_transfer_t flashXfer; flashXfer.deviceAddress = 0; flashXfer.port = FLASH_PORT; flashXfer.cmdType = kFLEXSPI_Command; flashXfer.SeqNumber = 1; flashXfer.seqIndex = NOR_CMD_LUT_SEQ_IDX_ENABLE_RESET; status = FLEXSPI_TransferBlocking(base, &flashXfer); if (status != kStatus_Success) { return status; } status = flexspi_nor_wait_bus_busy(base); flashXfer.deviceAddress = 0; flashXfer.port = FLASH_PORT; flashXfer.cmdType = kFLEXSPI_Command; flashXfer.SeqNumber = 1; flashXfer.seqIndex = NOR_CMD_LUT_SEQ_IDX_RESET_DEVICE; status = FLEXSPI_TransferBlocking(base, &flashXfer); if (status != kStatus_Success) { return status; } status = flexspi_nor_wait_bus_busy(base); return status; }             Then in the last file flexspi_nor_dma_transfer.c:   We are modifying the prototype flexspi_nor_get_vendor_id to:     extern status_t flexspi_nor_get_vendor_id(FLEXSPI_Type *base, uint8_t *vendorId, uint16_t *deviceId);     And we are going to add the following prototypes:     extern status_t flexspi_nor_get_status1(FLEXSPI_Type *base, uint8_t *status1); extern status_t flexspi_nor_get_status2(FLEXSPI_Type *base, uint8_t *status2); extern status_t flexspi_nor_get_status3(FLEXSPI_Type *base, uint8_t *status3); extern status_t flexspi_nor_reset_device(FLEXSPI_Type *base); extern status_t flexspi_nor_write_status1(FLEXSPI_Type *base, uint8_t status1); extern status_t flexspi_nor_write_status2(FLEXSPI_Type *base, uint8_t status2); extern status_t flexspi_nor_write_status3(FLEXSPI_Type *base, uint8_t status3); extern status_t flexspi_nor_erase_chip(FLEXSPI_Type *base);       In flexspi_device_config_t deviceconfig modify the following:     .dataValidTime = 2,     Modify the const uint32_t customLUT[CUSTOM_LUT_LENGTH] as follows:     const uint32_t customLUT[CUSTOM_LUT_LENGTH] = { /* Normal read mode -SDR */ [4 * NOR_CMD_LUT_SEQ_IDX_READ_NORMAL] = FLEXSPI_LUT_SEQ(kFLEXSPI_Command_SDR, kFLEXSPI_1PAD, 0x13, kFLEXSPI_Command_RADDR_SDR, kFLEXSPI_1PAD, 0x20), [4 * NOR_CMD_LUT_SEQ_IDX_READ_NORMAL + 1] = FLEXSPI_LUT_SEQ(kFLEXSPI_Command_READ_SDR, kFLEXSPI_1PAD, 0x04, kFLEXSPI_Command_STOP, kFLEXSPI_1PAD, 0), /* Fast read mode - SDR */ [4 * NOR_CMD_LUT_SEQ_IDX_READ_FAST] = FLEXSPI_LUT_SEQ(kFLEXSPI_Command_SDR, kFLEXSPI_1PAD, 0x0C, kFLEXSPI_Command_RADDR_SDR, kFLEXSPI_1PAD, 0x20), [4 * NOR_CMD_LUT_SEQ_IDX_READ_FAST + 1] = FLEXSPI_LUT_SEQ( kFLEXSPI_Command_DUMMY_SDR, kFLEXSPI_1PAD, 0x0A, kFLEXSPI_Command_READ_SDR, kFLEXSPI_1PAD, 0x04), /* Fast read quad mode - SDR */ [4 * NOR_CMD_LUT_SEQ_IDX_READ_FAST_QUAD] = FLEXSPI_LUT_SEQ(kFLEXSPI_Command_SDR, kFLEXSPI_1PAD, 0xEC, kFLEXSPI_Command_RADDR_SDR, kFLEXSPI_4PAD, 0x20), [4 * NOR_CMD_LUT_SEQ_IDX_READ_FAST_QUAD + 1] = FLEXSPI_LUT_SEQ( kFLEXSPI_Command_DUMMY_SDR, kFLEXSPI_4PAD, 0x0A, kFLEXSPI_Command_READ_SDR, kFLEXSPI_4PAD, 0x04), /* Write Enable */ [4 * NOR_CMD_LUT_SEQ_IDX_WRITEENABLE] = FLEXSPI_LUT_SEQ(kFLEXSPI_Command_SDR, kFLEXSPI_1PAD, 0x06, kFLEXSPI_Command_STOP, kFLEXSPI_1PAD, 0), /* Erase Sector */ [4 * NOR_CMD_LUT_SEQ_IDX_ERASESECTOR] = FLEXSPI_LUT_SEQ(kFLEXSPI_Command_SDR, kFLEXSPI_1PAD, 0x21, kFLEXSPI_Command_RADDR_SDR, kFLEXSPI_1PAD, 0x20), /* Read ID */ [4 * NOR_CMD_LUT_SEQ_IDX_READID] = FLEXSPI_LUT_SEQ(kFLEXSPI_Command_SDR, kFLEXSPI_1PAD, 0x9F, kFLEXSPI_Command_READ_SDR, kFLEXSPI_1PAD, 0x04), /* Write status 1 */ [4 * NOR_CMD_LUT_SEQ_IDX_WRITESTATUSREG1] = FLEXSPI_LUT_SEQ(kFLEXSPI_Command_SDR, kFLEXSPI_1PAD, 0x01, kFLEXSPI_Command_WRITE_SDR, kFLEXSPI_1PAD, 0x04), /* Write status 2 */ [4 * NOR_CMD_LUT_SEQ_IDX_WRITESTATUSREG2] = FLEXSPI_LUT_SEQ(kFLEXSPI_Command_SDR, kFLEXSPI_1PAD, 0x31, kFLEXSPI_Command_WRITE_SDR, kFLEXSPI_1PAD, 0x04), /* Write status 3 */ [4 * NOR_CMD_LUT_SEQ_IDX_WRITESTATUSREG3] = FLEXSPI_LUT_SEQ(kFLEXSPI_Command_SDR, kFLEXSPI_1PAD, 0x11, kFLEXSPI_Command_WRITE_SDR, kFLEXSPI_1PAD, 0x04), /* Dummy write, do nothing when AHB write command is triggered. */ [4 * NOR_CMD_LUT_SEQ_IDX_WRITE] = FLEXSPI_LUT_SEQ(kFLEXSPI_Command_STOP, kFLEXSPI_1PAD, 0x0, kFLEXSPI_Command_STOP, kFLEXSPI_1PAD, 0x0), /* Read status 1 register */ [4 * NOR_CMD_LUT_SEQ_IDX_READSTATUSREG1] = FLEXSPI_LUT_SEQ(kFLEXSPI_Command_SDR, kFLEXSPI_1PAD, 0x05, kFLEXSPI_Command_READ_SDR, kFLEXSPI_1PAD, 0x04), /* Read status 2 register */ [4 * NOR_CMD_LUT_SEQ_IDX_READSTATUSREG2] = FLEXSPI_LUT_SEQ(kFLEXSPI_Command_SDR, kFLEXSPI_1PAD, 0x35, kFLEXSPI_Command_READ_SDR, kFLEXSPI_1PAD, 0x04), /* Read status 3 register */ [4 * NOR_CMD_LUT_SEQ_IDX_READSTATUSREG3] = FLEXSPI_LUT_SEQ(kFLEXSPI_Command_SDR, kFLEXSPI_1PAD, 0x15, kFLEXSPI_Command_READ_SDR, kFLEXSPI_1PAD, 0x04), /* Erase whole chip */ [4 * NOR_CMD_LUT_SEQ_IDX_ERASECHIP] = FLEXSPI_LUT_SEQ(kFLEXSPI_Command_SDR, kFLEXSPI_1PAD, 0xC7, kFLEXSPI_Command_STOP, kFLEXSPI_1PAD, 0), /* Enable reset */ [4 * NOR_CMD_LUT_SEQ_IDX_ENABLE_RESET] = FLEXSPI_LUT_SEQ(kFLEXSPI_Command_SDR, kFLEXSPI_1PAD, 0x66, kFLEXSPI_Command_STOP, kFLEXSPI_1PAD, 0), /* Reset device */ [4 * NOR_CMD_LUT_SEQ_IDX_RESET_DEVICE] = FLEXSPI_LUT_SEQ(kFLEXSPI_Command_SDR, kFLEXSPI_1PAD, 0x99, kFLEXSPI_Command_STOP, kFLEXSPI_1PAD, 0), };       In int main(void) add the following variables:     uint16_t deviceID = 0; uint8_t status1 = 0, status2 = 0, status3 = 0;         in main, configure the DMAMUX as follows (this should be before DMA_Init(EXAMPLE_DMA):     /* Configure DMAMUX. */ RESET_PeripheralReset(kINPUTMUX_RST_SHIFT_RSTn); INPUTMUX_Init(INPUTMUX); INPUTMUX_AttachSignal(INPUTMUX, EXAMPLE_TX_CHANNEL, kINPUTMUX_FlexspiTxToDma0); INPUTMUX_AttachSignal(INPUTMUX, EXAMPLE_RX_CHANNEL, kINPUTMUX_FlexspiRxToDma0); /* Enable trigger. */ INPUTMUX_EnableSignal(INPUTMUX, kINPUTMUX_Dmac0InputTriggerFlexspiRxEna, true); INPUTMUX_EnableSignal(INPUTMUX, kINPUTMUX_Dmac0InputTriggerFlexspiTxEna, true); /* Turnoff clock to inputmux to save power. Clock is only needed to make changes */ INPUTMUX_Deinit(INPUTMUX);       in main, delete all the code from PRINTF("\r\nFLEXSPI dma example started!\r\n"); to one line before the last while(1). Before that while, add the following code:   PRINTF("\r\nFLEXSPI Unlock code started!\r\n"); /* FLEXSPI init */ flexspi_nor_flash_init(EXAMPLE_FLEXSPI); /* Get vendor ID. */ status = flexspi_nor_get_vendor_id(EXAMPLE_FLEXSPI, &vendorID, &deviceID); if (status != kStatus_Success) { PRINTF("Error getting flash ids: 0x%x\r\n", status); return status; } PRINTF("Vendor ID: 0x%x\r\n", vendorID); PRINTF("Device ID: 0x%x\r\n", deviceID); /* Get Status 1 */ status = flexspi_nor_get_status1(EXAMPLE_FLEXSPI, &status1); if (status != kStatus_Success) { PRINTF("Error getting status1: 0x%x\r\n", status); return status; } PRINTF("Status 1: 0x%x\r\n", status1); /* Get Status 2 */ status = flexspi_nor_get_status2(EXAMPLE_FLEXSPI, &status2); if (status != kStatus_Success) { PRINTF("Error getting status2: 0x%x\r\n", status); return status; } PRINTF("Status 2: 0x%x\r\n", status2); /* Get Status 3 */ status = flexspi_nor_get_status3(EXAMPLE_FLEXSPI, &status3); if (status != kStatus_Success) { PRINTF("Error getting status3: 0x%x\r\n", status); return status; } PRINTF("Status 3: 0x%x\r\n", status3); if(status2 & 0x01) { PRINTF("Error, The Flash Status register is locked! Disconnect and connect the board with the ISP button pressed to clear it and try again.\r\n"); return 0; } status1 = 0x00; status2 = 0x02; /* Write 0s to Status 1 */ status = flexspi_nor_write_status1(EXAMPLE_FLEXSPI, status1); if (status != kStatus_Success) { PRINTF("Error writing status1: 0x%x\r\n", status); return status; } /* Write 0x02 (Quad enabled only) to Status 2 */ status = flexspi_nor_write_status2(EXAMPLE_FLEXSPI, status2); if (status != kStatus_Success) { PRINTF("Error writing status2: 0x%x\r\n", status); return status; } /* Get Status 1 */ status = flexspi_nor_get_status1(EXAMPLE_FLEXSPI, &status1); if (status != kStatus_Success) { PRINTF("Error getting status1: 0x%x\r\n", status); return status; } PRINTF("Status 1: 0x%x\r\n", status1); /* Get Status 2 */ status = flexspi_nor_get_status2(EXAMPLE_FLEXSPI, &status2); if (status != kStatus_Success) { PRINTF("Error getting status2: 0x%x\r\n", status); return status; } PRINTF("Status 2: 0x%x\r\n", status2); PRINTF("Erasing the whole chip, it will take several minutes to complete. \r\n"); status = flexspi_nor_erase_chip(EXAMPLE_FLEXSPI); if (status != kStatus_Success) { PRINTF("Error erasing: 0x%x\r\n", status); return status; } PRINTF("Chip erased!\r\n");     Now we need to compile. But first, we need to link the application to RAM. Please right click on the project and go to Properties. in C/C++ Build go to Settings. In MCU Linker, select Managed Linker Script and check the Link application to RAM box. Apply and close.   Now compile the example in MCUXpresso. Once compiled, get the binary. Go to the Debug folder in the project, and you will see an .axf file. Right click on the file and select Binary Utilities > Create binary. Now, we need to modify that binary. Open you preferred binary editor and delete everything from 0x0 to 0x17FFFFFFF. The first address in the binary (0x0) must have the data from 0x18000000. Now we can flash the binary. We are going to do this with blhost. 2 USB C cables are needed. We are going to connect them via J10 and J8. But first we need to setup the board in ISP mode. Connect J8 to the PC. Press the ISP button (SW3) and with the button pressed connect the board via J10. In blhost run the following:     blhost -u 0x1fc9,0x0020 get-property 1     Disconnect and connect (J10) your board with the ISP button pressed. Now run the following (YOUR BINARY should be the path and file in which the binary is located):     blhost -u 0x1fc9,0x0020 -- fill-memory 0x20001000 0x4 0xC0100002 blhost -u 0x1fc9,0x0020 -- configure-memory 0x9 0x20001000 blhost -u 0x1fc9,0x0020 -- get-property 0x19 0x9 blhost -u 0x1fc9,0x0020 -- write-memory 0x20000000 <YOUR BINARY>.bin blhost -u 0x1fc9,0x0020 -- execute 0x2000026c 0x20000000 0x20120000     If the above steps were correct, you should be able to flash your board again. Please try with a hello world example in MCUXpresso.
查看全文
Chinese version   S32G的partition off流程要求核稳定的进 入到WFI状态,本文说明如何修改Linux内核, 在A53 Linux关机或kernel panic时,如何让所 有A53 Core进入WFI。 目录 1 背景说明与参考资料 .................................................. 2 1.1 背景说明 ................................................................. 2 1.2 参考资料 ................................................................. 5 1.3 测试工具 ................................................................. 6 2 Panic ......................................................................... 7 2.1 Panic代码流程分析 ................................................. 7 2.2 BSP30修改说明(Non-ATF) ................................... 10 2.3 BSP36修改说明(ATF) .......................................... 15 3 Poweoff ................................................................... 17 3.1 Poweroff代码流程分析 ......................................... 17 3.2 BSP30修改说明(Non-ATF) ................................... 19 3.3 BSP36修改说明(ATF) .......................................... 20 4 Reboot情况说明 ....................................................... 20 5 STR情况说明 ........................................................... 21   Contents 1    Background and Reference. 2 1.1  Background. 2 1.2  Reference materials. 5 1.3  Test Tools. 6 2    Panic. 7 2.1  Panic code flow analysis. 7 2.2  BSP30 Modification (Non-ATF) 10 2.3  BSP36 Modification (ATF) 16 3    Poweoff 18 3.1  Poweroff code analysis. 18 3.2  BSP30 Modification (Non-ATF) 20 3.3  BSP36 Modification (ATF) 21 4    Reboot Description. 21 5    STR Description. 21
查看全文
Some common issues of HSE-H based on S32G are summarized. Hope it can help you understand the known issues of HSE-H. The issue contents have been listed to facilitate finding the topic you care about. Please refer to the attachment for details. Thank you.
查看全文
本文说明在S32G上,如何升高以太网MDIO总线速度,其应用场景主要是为了提高MDIO的访问速度,来应对S32G对外部交换机的高速诊断要求,因为通常外部交换机可以支持高速MDIO。 本文说明方法并不保证信号质量和符合规范,请注意。 目录 1    需要的资料... 2 2    背景说明... 2 3    硬件说明... 3 4    PFE MCAL驱动代码修改... 4 4.1  MDIO时钟树说明... 4 4.2  创建PFE MCAL Master工程... 7 4.3  MDIO源代码说明... 7 4.4  源代码修改... 7 4.5  测试... 8 5    PFE Linux驱动修改说明(未测试) 9
查看全文
doc&project&patch&script explain to support GD qspi nor in lauterbach, flash tool,ivt,fls mcal, fls bootloader and linux/ chinese/english 目录 1    背景和参考资料... 2 1.1  背景说明... 2 1.2  参考资料... 3 1.3  硬件连接... 5 2    Lauterbach脚本驱动开发(可选) 5 2.1  准备参考脚本... 5 2.2  QuadSPI_ReadID.. 6 2.3  配置QSPI NOR为DOPI模式... 7 2.4  使用DOPI模式 READ_8DTRD.. 10 2.5  测试结果... 13 3    Flash tool算法镜像开发... 14 3.1  Flash SDK实现的算法... 15 3.2  开发新的flash源代码... 17 3.3  测试结果... 20 4    开发IVT参数头... 22 4.1  S32G QSPI控制器配置区别... 24 4.2  QSPI的配置区别... 28 4.3  测试结果... 29 5    开发MCAL Fls驱动... 30 5.1  MCAL Fls驱动工程说明... 30 5.2  FlsMem配置页... 34 5.3  MemCfg配置页... 35 5.4  测试结果... 49 6    开发Bootloader工程中Fls驱动... 51 6.1  Bootloader工程说明... 51 6.2  Bootloader与MCAL Fls驱动的不同点... 53 6.3  镜像打包... 54 6.4  测试结果... 56 7    开发Linux驱动(可选) 57 7.1  Linux GD驱动支持情况... 57 7.2  时钟相关的修改... 58 7.3  在DTS中增加GD flash的支持... 60 7.4  修改源代码增加flash信息结构体... 61 7.5  修改源代码中flash的fixup支持DTR模式... 62 7.6  Turning dummy值解决读错位的问题... 64 7.7  测试结果... 65   Content 1    Background and References. 2 1.1  Background. 2 1.2  References. 3 1.3  Hardware Link. 5 2    Lauterbach Script development(Optional) 6 2.1  Preparing the refer script 6 2.2  QuadSPI_ReadID.. 6 2.3  Configure QSPI NOR to DOPI mode. 8 2.4  Use DOPI mode  READ_8DTRD.. 11 2.5  Test report 13 3    Flash tool algorithm image development 15 3.1  Algorithms implemented by Flash SDK. 15 3.2  Develop new flash source code. 17 3.3  Test Report 21 4    Develop IVT Parameter Header 23 4.1  S32G QSPI Controllder configuration difference. 25 4.2  QSPI Configuration Difference. 30 4.3  Test Report 30 5    Develop MCAL Fls driver 31 5.1  MCAL Fls Driver Project Details. 31 5.2  FlsMem Configuration page. 35 5.3  MemCfg Configuration page. 36 5.4  Test Report 51 6    Develop Bootloader Project Fls Drivedr 52 6.1  Bootloader Project Details. 52 6.2  Difference of Bootloader and MCAL Fls Driver 54 6.3  Image Package. 56 6.4  Test Report 58 7    Develop Linux Driver(Optional) 59 7.1  Linux GD Driver Details. 59 7.2  Modification of Clock. 60 7.3  In DTS add GD flash Support 62 7.4  Modify source code and add flash information structure  63 7.5  Modify the fixup of flash in source code to support DTR mode  64 7.6  Turning Dummy Value to Solve the Misplacement Problem   66 7.7  Test Report 67
查看全文
本文说明在S32G3 RDB3板上,Uboot中使能PFE驱动时,需要加载PFE FW,默认Uboot中,PFE FW是放在SD/eMMC的FAT分区,通过文件系统访问来读取。本文说明如何修改为从QSPI NOR中读取。主要的应用场景是:  在烧写镜像时,需要Uboot通过网口来烧写内核镜像及rootfs。而此时SD/eMMC还没有分区,所以无法将PFE网口需要的FW放在FAT分区中。 目录 1    背景与相关资料... 2 1.1  问题背景... 2 1.2  需要的软件,工具与文档... 3 2    将Uboot PFE FW放在QSPI Nor上... 4 2.1  Uboot代码说明与修改... 4 2.2  测试... 6
查看全文
本文说明在S32G上如何修改eMMC时钟,来避开200Mhz的或及倍频的频率EMI干扰检查点。 目录 1    背景说明和需要的资料... 2 1.1  背景说明... 2 1.2  需要的资料... 2 2    eMMC的硬件连接... 3 3    eMMC时钟初始化方法... 4 3.1  eMMC时钟源说明及修改目标... 4 3.2  M7+Bootloader方法(可选项) 6 3.3  ATF初始化方法... 7 4    修改eMMC时钟... 9 4.1  ATF的修改... 9 4.2  Uboot相关的修改... 9 4.3  非整除时钟的修改考虑... 10 5    测试结果... 11 update to V2,增加分数分频: 6    分数分频... 13 6.1  调试方法... 13 6.2  代码修改... 14 6.3   测试结果   15
查看全文
本文说明S32G在Linux中如何使用内存读写工具来发起一个HSE Server服务请求,以确认HSE是否正常工作。本说明的目的旨在在极端缺少Debug手段的情况下,确认HSE的状态。 目录 1    背景说明与参考资料... 2 1.1  背景说明... 2 1.2  参考资料... 2 2    启动包含HSE的Linux镜像... 3 3    HSE服务代码逻辑与寄存器状态... 3 3.1  HSE Demo示例... 3 3.2  IDEL情况下MU寄存器状态... 6 4    使用Linux memtool命令来访问HSE. 10 4.1  检查HSE状态... 10 4.2  准备hseSrvDescriptor_t数据结构... 10 4.3  申请HSE服务... 11 5    其它建议... 12
查看全文
本文说明如何配置MCAL UART模块为DMA模式。 默认的MCAL UART模块是使用的PIO模式。 本文采用软件版本为MCAL RTD 4.0.2。 目录 1    背景与资料说明... 2 1.1  背景说明... 2 1.2  所需资料说明... 2 2    创建UART工程... 2 2.1  打开工程... 2 2.2  修改波特率... 3 2.3  编译... 3 2.4  默认工程说明与运行... 4 3    配置UART DMA模式... 5 3.1  参考资料... 5 3.2  增加并配置MCL模块... 5 3.3  修改UART模块... 6 3.4  修改Platform模块... 7 3.5  处理Cache相关问题... 7 3.6  测试结果... 8
查看全文
本文说明如何配置MCAL ICU模块为GPIO Input。 默认的MCAL ICU模块是使用FTM输入为示例的。 本文采用软件版本为MCAL RTD 4.0.2 目录 1    背景与资料说明... 2 1.1  背景说明... 2 1.2  所需资料说明... 2 2    创建ICU工程... 3 2.1  打开工程... 3 2.2  编译与运行... 3 2.3  默认工程说明... 4 3    增加GPIO输入支持... 6 3.1  修改说明... 6 3.2  修改Port模块... 6 3.3  修改ICU模块... 7 3.4  Platform模块... 8 3.5  主测试程序修改... 9 3.6  测试结果... 10
查看全文
本文说明S32G3 M7核Standby MCAL demo 详细情况及定制,并在进入Standby之前 调用QSPI 接口将QSPI NOR flash配置进入 deep power down模式,以节省用电。 目录 1    参考资料说明... 2 2    G2和G3 Demo的区别... 2 3    G3 MCAL Demo的实现... 4 3.1  修改UART驱动... 4 3.2  实现时钟关闭代码... 4 3.3  配置电源模式切换驱动... 5 3.4  配置唤醒源... 5 3.5  加入PMIC驱动... 6 3.6  主函数逻辑实现... 7 3.7  运行测试... 7 3.8  未来开发计划... 8 4    将QSPI NOR设置进入Deep Power Down模式... 8 4.1  Fls层的修改... 10 4.2  中间层的修改... 10 4.3  QSPI_IP层的修改... 13 4.4  主测试函数调用... 16 4.5  Fls驱动的测试... 17 5    将Deep Power Down功能集成到STANDBY工程中并测试    18 5.1  EB配置... 18 5.2  主测试函数与编译修改... 20 5.3  运行测试... 21
查看全文
现在越来越多的客户,对于S32G PFE在master/slave的使用有了需求。 但是,PFE只有4个HIF接口,HIF0~HIF3,而PFE有3个EMAC口,以及LLCE2PFE也需要要给HIF,从而HIF成为一个关键资源。 同时,有些客户需要从A核,M核的业务考量,A核和M核的网络不仅要和外部设备进行通信,同时A核和M核内部也有通信需求,并且需要把业务报文和管理报文分离,这就对PFE master/slave的使用场景有了更多变化,以及对各种配置有了更多需求。 因此,针对PFE/Slave的几种使用典型的使用场景,进行配置。
查看全文
在进行时钟同步时,目前S32G2/G3有一种很典型的使用场景: Grand master clock  <-> S32G PFE <-> 其余连接在PFE 某些 eMAC口上的设备 外部的grand master clock,连接在PFE的一个eMAC上,要同步S32G以及连接在PFE其余eMAC上的设备时钟。 但是S32G2/G3的PFE仅仅是支持timestamp,对于将S32G PFE设置成交换机使用时,PFE不能实现Transparent clock的功能。 因此,本文讨论将PFE + S32G SoC当作Transparent clock,以及将PFE + S32G当作boundary clock,来同步S32G以及其余部件的时钟。
查看全文
This doc explain bootloader secure boot feature and how to re-develop it to support: .FW update .OTP attribute access .IVT protect: 目录 1 参考资料 .................................................................... 2 2 S32G Secure Boot说明 ............................................. 2 2.1 IVT头格式与Secure Boot相关 ................................ 3 2.2 Secure Boot流程 .................................................... 3 2.3 Secure Boot配置 .................................................... 4 2.4 Secure Boot涉及到的HSE内容 ............................... 6 3 环境搭建 .................................................................... 7 3.1 搭建编译环境 .......................................................... 7 3.2 IVT镜像制造 ........................................................... 7 3.3 镜像烧写 ................................................................. 8 3.4 Bootloader Secure Boot测试 .................................. 8 4 Bootloader Secure Boot代码与功能说明 ................... 9 4.1 EB配置说明: ........................................................ 9 4.2 EB生成代码说明: ............................................... 15 5 定制1:HSE FW update .......................................... 22 5.1 代码开发 ............................................................... 22 5.2 测试 ...................................................................... 25 6 定制2:HSE OTP Attribute设置 ............................... 26 6.1 代码开发 ............................................................... 26 6.2 模拟测试 ............................................................... 33 7 定制3:IVT签名 ....................................................... 35 7.1 代码开发 ............................................................... 35 7.2 模拟测试 ............................................................... 40 Contents 1 Reference Materials .................................................. 2 2 S32G Secure Boot ..................................................... 3 2.1 IVT header format for the Secure Boot part .......... 3 2.2 Secure Boot Flow ................................................... 3 2.3 Secure Boot Configuration ..................................... 4 2.4 HSE background of Secure Boot ........................... 6 3 Build the Project ........................................................ 7 3.1 Build the Compiling Environment ........................... 7 3.2 Create IVT Image ................................................... 7 3.3 Burning Image ........................................................ 8 3.4 Bootloader Secure Boot Testing ............................ 9 4 Bootloader Secure Boot Codes and Function Description 9 4.1 EB Configuration .................................................... 9 4.2 EB output codes ................................................... 15 5 Customization 1:HSE FW update ......................... 22 5.1 Codes development ............................................. 23 5.2 Testing ................................................................. 26 6 Customization 2:HSE OTP Attribute Setting ......... 26 6.1 Code Development .............................................. 27 6.2 Simulation test ...................................................... 34 7 Customization 3:IVT Signature ............................. 36 7.1 Codes Development ............................................. 36 7.2 Simulation Testing ................................................ 40  
查看全文
本文说明了S32G如何储存mac地址,包括dts保存,systemd指定和fuse保存的办法: 目录 1 需要的软件................................................................. 2 2 背景说明 .................................................................... 2 3 PFE eMAC MAC地址说明 ......................................... 2 3.1 DTS配置 ................................................................. 2 3.2 源代码说明 ............................................................. 3 3.3 测试 ........................................................................ 4 4 GMAC0 MAC地址说明 .............................................. 4 4.1 DTS配置 ................................................................. 4 4.2 源代码说明 ............................................................. 4 4.3 SystemD脚本 ......................................................... 5 4.4 固定GMAC MAC地址的修改办法 ........................... 6 5 用Uboot命令烧写FUSE MAC地址项 .......................... 7 6 修改为从fuse中获得GMAC0 MAC地址 ...................... 9 6.1 Uboot代码修改 ....................................................... 9 6.2 Uboot写MAC寄存器说明 ...................................... 10 6.3 测试 ...................................................................... 10  
查看全文
本文为如下G2版本的升级篇,使用G3+更新的软件 目录 1    需要的软件与工具... 2 1.1  软件工具与文档... 2 1.2  开发说明... 3 2    测试软件安装编译说明... 3 2.1  安装LLCE Logger驱动... 3 2.2  编译LLCE驱动测试程序(以CAN Logger 为例) 4 2.3  Logger Demo功能说明... 5 2.4  M7 BootLoader ATF镜像冲突检查... 7 2.5  LLCE Logger Demo去掉CLOCK INIT. 9 2.6  LLCE Logger Demo去掉MCU 相关INIT. 10 2.7  LLCE Logger Demo程序去掉PORT INIT. 10 2.8  中断冲突说明... 10 2.9  去掉其它无用初始化... 11 3    Bootloader工程说明... 11 3.1  关掉XRDC支持... 12 3.2  关掉eMMC/SD支持(可选) 13 3.3  关掉secure boot(可选) 14 3.4  增加LLCE 驱动所需要的PORT 的初始化... 15 3.5  解决Bootloader,MCAL 与Linux 的clock 冲突... 16 3.6  配置A53 Boot sources: 34 3.7  配置M7 Boot sources: 36 3.8  关闭调试软断点... 37 3.9  编译Bootloader工程... 38 3.10 制造Bootloader的带IVT的镜像... 39 3.11 烧写镜像... 41 4    Linux LLCE logger功能修改... 42 4.1 ATF的修改... 42 4.2 Linux中关于LLCE配置... 44 4.3 LLCE相关初始化冲突说明... 45 5    测试... 46 5.1  硬件连接... 46 5.2  LLCE logger 测试过程... 46 S32G Boot customization doc how to run bootloader to run mcal&linux https://community.nxp.com/t5/NXP-Designs-Knowledge-Base/S32G-Bootloader-Customzition/ta-p/1519838
查看全文
本文说明S32G HSE On-demand SMR验证的应用方法,本文演示的示例应用为: Secure Bootloader对Linux Bootloader fip.bin的验证 目录 1    背景说明与参考资料... 2 1.1  背景说明... 2 1.2  参考资料... 3 2    S32G On-demand SMR Verification说明... 4 2.1  SMR Verify的说明... 4 2.2  On-demand SMR Verify. 4 3    环境搭建... 5 3.1  EB配置说明... 5 3.2  ATF编译说明... 8 3.3  镜像烧写... 9 4    Bootloader代码开发... 9 4.1  OnDemand SMR install 9 4.2  OnDemand SMR verify. 13 5    测试... 16 5.1  Lauterbach跟踪... 17 5.2  Fip.bin破坏实验... 19 5.3  硬件确认... 19   This application doc explains the application method of S32G HSE On_demand SMR verification. The example application demonstrated in this doc is: Secure Bootloader verification of Linux Bootloader fip.bin This application doc explains the application method of S32G HSE On_demand SMR verification. The example application demonstrated in this doc is: Secure Bootloader verification of Linux Bootloader fip.bin Contents 1    Background Description and Reference Materials. 2 1.1  Background Description. 2 1.2  Reference Materials. 3 2    S32G On-demand SMR Verification. 4 2.1  SMR Verify. 4 2.2  On-demand SMR Verify. 4 3    Build the Development Environment 5 3.1  EB Configuration. 5 3.2  ATF Compiling. 8 3.3  Burn Image. 9 4    Bootloader Codes Development 9 4.1  OnDemand SMR install 9 4.2  OnDemand SMR verify. 13 5    Testing. 16 5.1  Lauterbach Tracking. 16 5.2  Fip.bin Broken Test 19 5.3  Probe the Hardware. 19
查看全文
本文探讨了如何解决i.MX8MP EMC测试遇到的问题,主要针对辐射超标问题。除了硬件方案,着重探讨了LVDS展频等软件方案。
查看全文
S32G Host Secure debug methods with Lauterbach tool after LC is updated, and some details about secure debug knowledge in S32G. 本文主要描述S32G在演进生命后如何使用lauterbach工具来进行调试,涉及到S32G HSE相关知识点。
查看全文
本文说明S32G LLCE CAN Linux驱动的 快速测试方法。 目录 1 参考资料 .................................................................... 2 1.1 参考资料 ................................................................. 2 1.2 版本匹配说明 .......................................................... 2 2 环境搭建 .................................................................... 3 2.1 使用Yocto编译 ........................................................ 3 2.2 使用Standalone编译 ............................................... 4 3 测试 ........................................................................... 5 3.1 硬件连接 ................................................................. 5 3.2 测试方法 ................................................................. 6 4 LLCE CAN Linux驱动说明 ......................................... 7 4.1 DTS ........................................................................ 7 4.2 源代码 .................................................................... 9  
查看全文