; -------------------------------------------------------------------------------- ; @Title: Programm QSPI flash on 88Q5151, 88Q5152 or 88Q5192 device ; @Description: ; Sets up flash declaration, load flash driver for QSPI programming ; Prerequisites: ; * Connect Debug Cable/Combiprobe to HDR1 JTAG ; @Keywords: ARM, Cortex-R52, 88Q5151, 88Q5152, 88Q5192 ; @Author: BES ; @Board: 88Q5151_DB ; @Chip: 88Q5151 ; @Copyright: (C) 1989-2022 Lauterbach GmbH, licensed for use with TRACE32(R) only ; -------------------------------------------------------------------------------- ; $Id: 88q51xx-spi.cmm 11467 2022-10-25 10:18:43Z jjeong $ LOCAL &arg1 &QSPI_BASE ENTRY &arg1 &QSPI_BASE=0x50000000 WinCLEAR RESet SYStem.RESet SYStem.CPU 88Q5151 ; SYStem.CPU 88Q5152 ; SYStem.CPU 88Q5192 SYStem.MemAccess DAP SYStem.JtagClock 10MHz SYStem.Up Register.Set M 0x13 ; Run flash algorithm in supervisor mode ; Need to disable MPU - bit0 of SCTLR; 'xX' are don't cares; ; '0y' prefix shows binary format Data.Set c15:0x0001 %Long 0yXXXXxxxxXXXXxxxxXXXXxxxxXXXXxxx0 ; And set direct read register to first flash MB window Data.Set SD:(&QSPI_BASE+0x98) %LE %Long 0x218feb GOSUB READ_ID_TEST ; -------------------------------------------------------------------------------- programFlash: FLASHFILE.RESet FLASHFILE.CONFIG &QSPI_BASE FLASHFILE.TARGET 0x1000++0x1FFF 0x3000++0x1FFF ~~/demo/arm/flash/byte/spi64_88q5050.bin /KEEP FLASHFILE.GETID IF "&arg1"=="PREPAREONLY" ENDDO ; FLASHFILE.ERASE 0x0++0x1FFFFF ; erase 2MB size ; FLASHFILE.LOAD *.bin 0x0 ; Write uboot.bin to 0x0 on the serial flash ; FLASHFILE.LOAD *.bin 0x0 /ComPare ; Verify FLASHFILE.DUMP 0x0 ; Read out from the serial flash ENDDO ; -------------------------------------------------------------------------------- READ_ID_TEST: ( Data.Set (SD:(&QSPI_BASE+0x14))++0x1F %Long 0x0 ; clear the ind_acc_cmd buffer Data.Set SD:(&QSPI_BASE+0x14) %Long (0xD<<15.)|0x9F ; ind_acc_cmd0 Data.Set SD:(&QSPI_BASE+0x00) %Long (0x3<<8.)|0x81 ; read 3bytes, execute ind_acc_cmd0 WAIT 100.ms PRINT "Read = 0x" Data.Long(SD:&QSPI_BASE+0x08) PRINT "Read 3rd = 0x" (Data.Long(SD:(&QSPI_BASE+0x08))>>16.)&0xFF PRINT "Read 2nd = 0x" (Data.Long(SD:(&QSPI_BASE+0x08))>>8.)&0xFF " (Device ID)" PRINT "Read 1st = 0x" Data.Long(SD:(&QSPI_BASE+0x08))&0xFF " (Manufacture ID)" RETURN )