Hello,
Mostly we use our own libraries for the initialization.
Here is the initialization part of the SEMC:
------------------------------------------
// Enable SEMC
imxrt_set_clock_gate(3, 4, 3); // SEMC clock
imxrt_set_clock_gate(1, 18, 3); // SEMC exsc clock
uint32_t tmp;
SEMC_Type * regs = SEMC;
/* Initialize all BR to zero due to the default base address set. */
for (tmp = 0; tmp < 9; tmp++)
{
regs->BR[tmp] = 0;
}
/* Software reset for SEMC internal logical . */
regs->MCR |= SEMC_MCR_SWRST_MASK;
while (regs->MCR & SEMC_MCR_SWRST_MASK)
{
}
regs->MCR |= 2; // disable
tmp = 0
| (16 << 24) // BTO: bus timeout
| (80 << 16) // CTO: command timeout
| (1 << 1) // disable
;
regs->MCR = tmp;
tmp &= ~2;
regs->MCR = tmp; // enable
tmp = regs->IOCR;
tmp &= ~7;
tmp |= 3; // set A8 to PSRAM CE = 3, NOR CE = 2
regs->IOCR = tmp;
tmp = 0
| (FPGA_BASE_ADDRESS << 0) // BA: base address
| (0 << 1) // MS(5): 1 = 4 kByte (only 11 address bits are used by the FPGA)
| (1 << 0) // VLD: valid
;
regs->BR[6] = tmp; // set the base register for the (P)SRAM
regs->SRAMCR0 = 0
| (15 << 12) // COL(4): Column address bits ??? 0 = 12 Bits
| (0 << 10) // ADVP: ADV polarity, 0 = low active
| (0 << 8) // AM(2): Address Mode, 0 = Address / Data MUX Mode
| (0 << 4) // BL(3): Burst Length, 0 = 1
| (1 << 0) // PS: Port Size, 1 = 16 Bit
;
regs->SRAMCR1 = 0
| (1 << 28) // REH(4): RE high time
| (1 << 24) // REL(4): RE low time
| (1 << 20) // WEH(4): WE high time
| (1 << 16) // WEL(4): WE low time
| (1 << 12) // AH(4): Address hold time
| (1 << 8) // AS(4): Address setup time
| (0 << 4) // CEH(4): CE hold min time
| (0 << 0) // CES(4): CE setup time
;
regs->SRAMCR2 = 0
| (3 << 24) // CEITV(4): CE interval min time
| (0 << 20) // RD(4): read cycle time
| (0 << 16) // LC(4): latency count
| (0 << 12) // AWDH(4): address to write data hold time cycle
| (1 << 8) // TA(4): turnaround time cycle
| (0 << 4) // WDH(4): write data hold time
| (0 << 0) // WDS(4) write data setup time
;
-----------------------------------
The other untouched SEMC registers are left with their default values.
I've checked the assembly of the test code, for the writes it uses single strh instructions.
I hope this helps, but if not, I'm always ready to give more information.
All the best,
Viktor