Other Parts Discussed in Thread: HALCOGEN
Trying to write/read to the NOR Flash S29GL128P using EMIF but can only read 0xFFFF instead of the actual data that was written, here are my steps
- Halcogen settings
- Enabled EMIF interface but disabled the pins EMIF_nOE, EMIF_nDQM[0], EMIF_RNW due to conflicts
- Selected ASYNC1, selected NOR Flash
- Left the timing fields as default
- Added the following line to linker file HL_sys_link.c
/* USER CODE BEGIN (3) */
EMIF_1 (RX) : origin=0x60000000 length=0x00000100
/* USER CODE END */ - Here is the main code
int main(void)
{
/* USER CODE BEGIN (3) */_enable_IRQ_interrupt_();
_mpuInit_();
_mpuEnable_();
emif_ASYNC1Init();uint16_t *base_addr = (uint16_t *) 0x60000000;
uint16_t data1 = 0x1234;
uint16_t Read_back_data = 1947;
*((uint16_t *) base_addr + 0x555) = 0x00AA; /* write unlock cycle 1 */
*((uint16_t *) base_addr + 0x2AA) = 0x0055; /* write unlock cycle 2 */
*((uint16_t *) base_addr + 0x555) = 0x00A0; /* write program setup command */
*((uint16_t *) 0x60000000) = data1; /* write data to be programmed */
__delay_cycles(150000);
Read_back_data = *((uint16_t *) 0x60000000);/* USER CODE END */
return 0;
}
Questions:
- Any missing code/HALCOGEN settings to be added?
- As per the datasheet of the NOR Flash S29GL128P, polling algorithm should be performed after writing program data. This polling algorithm involves monitoring of the DQ pins. But the DQ pins are not found in HL_emif.c, HL_emif.h or HL_reg_emif.h. Where to access these DQ pins in the user space?
Many thanks in advance!