S32G399A octal DTR reads fail with Macronix MX66UM2G45G QSPI flash Hi Community, We have a custom board based on the S32G399A-RDB3 reference design. The main change to the boot flash is that we replaced the MX25UW51245G (64 MB) with a Macronix MX66UM2G45G (256 MB, 1.8 V octal, JEDEC ID C2 80 3C). Everything works in 1-1-1 SPI. We cannot get 8D-8D-8D (octal DTR) reads to return correct data, and we would like help from NXP. We also could not find this part in any S32 BSP release up to bsp48.0, although AMD's U-Boot has supported it since 2024.1. Software TF-A bsp43.0-2.10.7, U-Boot bsp43.0-2022.04, Linux bsp43.0 (6.6.52) BootROM QSPI parameters: mx66_sim133sdr.bin (512 bytes, "OPI SDR 133 MHz"), taken unchanged from S32 Design Studio 3.6.1, Platform SDK S32XX 4.0.0, processors/S32G399A/.../quadspi/default_boot_images/. We did not generate it with U-Boot's s32cc_qspiparams tool. U-Boot changes: the flash ID entry for 0xC2803C, plus the octal-SDR soft reset. The BootROM leaves the flash in OPI SDR, and without the reset RDID returns 00 00 00. What works: - Boot from QSPI at 1-1-1, 133 MHz (~16 MB/s), in BootROM, TF-A, U-Boot and Linux. - Linux reads and writes, after we forced the IP-command path. With the flash in 1-bit mode, the AHB direct-map read path in spi-fsl-qspi.c causes a synchronous external abort or a hang. What we did to enable octal DTR in U-Boot 1. Set spi-tx-bus-width / spi-rx-bus-width to 8. The flash then negotiates and enables 8D-8D-8D: opcode 0xEE, octal_dtr_enable() returns 0, and probe reports 256 MiB. 2. Found a dummy-cycle mismatch. SFDP gave 14 dummy cycles, but the flash defaults to 20 (CR2 at 0x300). We now program CR2[0x300] = 0 (20 cycles) and set read_dummy = 20. Before this fix, reads returned random data that changed on every read of the same address: *** Warning - bad CRC, using default environment
Too large ELF file, size: 3568570404 <- PFE firmware header, read 1
Too large ELF file, size: 1226703397 <- same header, read 2
Bad Linux ARM64 Image magic! 3. Read the ID back in DTR mode: 3c 3c 3c 3c c2 c2. Both correct values come back, so we believe the flash really is in octal DTR. The problem Expected first bytes at the kernel offset: 1f 20 03 d5 19 80 31 14. The controller registers (read individually) are: MCR 030f00cc SMPR 33000000 DLLCRA c280000d
DLCR 40ff40ff DLLSR 8000c078 (both DLLs locked)
FR 09000001 (no DLPFF flag) - MCR DQS source = external (driver default for DDR): we get only 2 DTR clocks of data, then zeros: 1f 20 1f d5 00 00 00 00. The result is deterministic, and the controller reports a successful transfer. - MCR DQS source = internal (MCR[25:24] = 1): all the data arrives, but one DDR edge lags the other by exactly one clock: expected: 1f 20 | 03 d5 | 19 80 | 31 14
read: 1f 20 | 1f d5 | 03 80 | 19 14 | 31 .. The second byte of every pair is correct. The first byte of every pair is the correct sequence, delayed by one clock. DQS source sweep (MCR[25:24], BSWAP on/off), first 12 bytes read: bswap src MCR data result
on 2 020f00cc 19 80 19 19 14 14 31 14 00 00 00 00 bad
on 3 030f00cc 1f 20 1f d5 00 00 00 00 00 00 00 00 bad
off 0 000f00cc 31 0c 00 1d 55 02 19 18 31 20 00 00 bad
off 1 010f00cc 1f 20 1f d5 03 80 19 14 31 00 00 00 bad
off 2 020f00cc 80 19 19 19 14 14 14 31 00 00 00 00 bad
off 3 030f00cc 20 1f d5 1f 00 00 00 00 00 00 00 00 bad What we swept, with a full disable -> configure -> enable -> DLL-lock cycle each time (none fixed it): - SMPR DLLFSMPFA/FB_NTH 0-7, with DLP on and off - MCR END_CFG 0-3, with SFACR BSWAP on and off: this only reorders the same wrong bytes - MCR DQS source 0-3 - SMPR DDRSMP 0-7, with FSPHS on and off: no effect at all on the data Code changes (test builds only, on top of the bsp43.0 sources) TF-A fdts/s32cc-nxp-flash-macronix.dtsi (the DTB that U-Boot uses): mx66um2g45g@0 {
compatible = "jedec,spi-nor";
spi-tx-bus-width = <8>; /* was 1 */
spi-rx-bus-width = <8>; /* was 1 */
}; U-Boot drivers/mtd/spi/spi-nor-core.c, spi_nor_macronix_octal_dtr_enable(), before CR2[0x0] is switched to DTR OPI: u8 dc = 0x00; /* CR2[0x300] = 0 -> 20 dummy */
write_enable(nor);
op = (struct spi_mem_op)
SPI_MEM_OP(SPI_MEM_OP_CMD(SPINOR_OP_WRCR2, 1),
SPI_MEM_OP_ADDR(4, 0x300, 1),
SPI_MEM_OP_NO_DUMMY,
SPI_MEM_OP_DATA_OUT(1, &dc, 1));
spi_mem_exec_op(nor->spi, &op);
spi_nor_wait_till_ready(nor);
nor->read_dummy = 20; /* SFDP gave 14 */ U-Boot drivers/spi/fsl_qspi.c, enable_octal_ddr(), DQS source test (internal DQS instead of the octal_ddr_conf default DQS_EXTERNAL): mcr |= octal_ddr_conf.mcr;
mcr &= ~QUADSPI_MCR_DQS_EXTERNAL; /* clear MCR[25:24] */
mcr |= QUADSPI_MCR_DQS_INT_PAD; /* MCR[25:24] = 1 */
qspi_writel(q, mcr, base + QUADSPI_MCR); The register sweeps used a test U-Boot command that repeats the full enable_octal_ddr() sequence (MDIS=1, program MCR/SMPR/DLCR/SFACR, MDIS=0, wait for DLL lock) for each setting, then reads 512 bytes 3 times. Board side: DQS is pinmuxed (pads 85-93, IMCR 540-548). Questions 1. Is external DQS required for 8D-8D-8D at 133 MHz on the S32G3 QuadSPI? Is "2 clocks then zeros" a known symptom of a missing or bad DQS return? 2. Is internal DQS (loopback) supported in DDR mode? If so, which register settings fix the one-clock skew between edges? DLLCRA slave-delay settings, perhaps? 3. Do you have validated QuadSPI settings (MCR/SMPR/DLLCRA/FLSHCR), or a BootROM parameter set, for the MX66UM2G45G or another 1.8 V Macronix octal part on S32G3? The same S32DS folder also has mx66_sim133ddr.bin. Has that octal DTR boot image been validated on S32G3, and on which board? 4. Is the AHB read path in the Linux spi-fsl-qspi driver validated only for octal DTR? Is it expected to fault when the flash runs in 1-1-1? 5. Is NXP planning to add the MX66UM2G45G (JEDEC ID C2 80 3C) to the S32 BSP? We checked the U-Boot, Linux and TF-A releases up to bsp48.0 and found no entry for it. AMD's U-Boot fork (u-boot-xlnx) has supported this part with octal-DTR read and program since its 2024.1 release, and mainline U-Boot supports its 1 Gbit sibling, the MX66UM1G45G (C2 80 3B). If support is planned, which BSP release is it targeted for? Would it include validated QuadSPI and BootROM parameters for octal DTR? We can share full logs and the register sweep tables. Thank you. Re: S32G399A octal DTR reads fail with Macronix MX66UM2G45G QSPI flash Hi Dheeraj,
Thank you for the detailed information.
Since this issue involves a custom board and the MX66UM2G45G, which is different from the flash used on the S32G3 RDB3, we cannot reproduce or validate the behavior on an equivalent setup. Nevertheless, I will do my best to assist and coordinate further investigation as needed.
You mentioned that 8D-8D-8D Octal DTR cannot be used, but the Software section lists mx66_sim133sdr.bin. Since this indicates an SDR image, please clarify whether mx66_sim133sdr.bin or mx66_sim133ddr.bin is being used, and whether both the flash and QuadSPI controller are configured for Octal DTR before the read.
The read-ID result 3c 3c 3c 3c c2 c2 shows that communication is occurring, but it does not fully confirm correct 8D-8D-8D operation. If possible, please provide oscilloscope captures of SCLK, DQS, and SIO[0:7] during the read-ID and failing read operations.
As a diagnostic, please repeat the same read at a lower Clock frequency, such as approximately 104 MHz, 84 MHz, and 66 MHz, while keeping the Octal DTR and DQS configuration consistent.The controller clock, flash dummy-cycle setting, LUT sequence, and other timing parameters must remain consistent with the selected frequency. Any change in the data or error pattern could indicate a timing or signal-integrity issue.
For reference, please review:
S32 Flash Tool User Guide, UG10237, Section 4.
S32 Flash Tool for S32 Platform
AN13563, S32G QuadSPI Deep Dive, Section 4 and 5.
HOWTO: Use FlashSDK to add support for QuadSPI flash memory devices
The questions raised require additional investigation and may involve other NXP teams. I will provide further information as it becomes available.
Best regards, Aldo Re: S32G399A octal DTR reads fail with Macronix MX66UM2G45G QSPI flash Hi Aldo, Thank you for the suggestions. Here is what we found. 1. Bin file We use mx66_sim133sdr.bin. It is only used by the BootROM to load BL2 in octal SDR at 133 MHz, which works. Octal DTR is enabled later in U-Boot, and both the flash and the controller are in 8D-8D-8D for the failing reads. We have not tried mx66_sim133ddr.bin yet. Its controller settings (MCR 0x030F00CC, DLLCR 0x8280000C, SMPR 0x44000000, external DQS) are the same ones we tested in U-Boot below, so we expect the same failure. 2. Controller settings We used the S32G3 data sheet Table 54 "DDR-133MHz" column: MCR 0x030F00CC, SMPR 0x44000000, DLLCRA 0x8280000D, FLSHCR 0x00010303, SFACR BSWAP. The DLL locks (DLLSR 0x8000C014). 3. Failure pattern with external DQS Command, address and dummy cycles are correct and the first 16-bit word is read correctly. After that, data is captured only on some DQS edges. Words are repeated and others are skipped. Example (16 bytes): Expected: 54 71 00 90 94 a2 2e 91 f5 5b 02 a9 13 41 38 d5 Read: 54 71 54 54 00 90 00 00 94 a2 38 d5 38 38 95 06 4. Settings sweep with external DQS No setting works: NTH 0-7, DLL auto/manual/bypass, slave delay offset 0-7 and coarse 0-15, TDH 0-2, DDRSMP 0-7. The QSPI pad configuration is correct (MSCR = 0x00282001 for all QSPI pads including DQS PF_13). 5. Frequency sweep We tested 133, 100, 80 and 66.7 MHz (the closest rates to 104/84/66 MHz we can generate). External DQS fails at every frequency with the same pattern. 6. Internal DQS With internal DQS (MCR 0x010F00CC) and the DLL in manual mode, octal DTR reads are correct (verified with 16 MB CRC checks). The working slave delay offsets widen as the clock drops: 133 MHz: 7, 100 MHz: 4-7, 80 MHz: 2-7, 66.7 MHz: 1-7. Octal SDR (8S-8S-8S) at 133 MHz also works reliably. Since the external DQS path fails at every frequency and setting, we suspect a problem on the DQS signal on our board. Note that DQS is shared with a second flash device on the same bus which is not enabled. We will capture SCLK, DQS and SIO with the oscilloscope and share the images. Is there anything else on the controller side we should check for external DQS? -Dheeraj Re: S32G399A octal DTR reads fail with Macronix MX66UM2G45G QSPI flash Hi Aldo, Thank you for the response. To clarify, we are using mx66_sim133sdr.bin. It is used only by the BootROM, so it does not affect the octal DTR problem. Octal DTR is enabled later, at U-Boot stage, when the SPI-NOR framework switches the flash to DTR and enable_octal_ddr() configures the QuadSPI controller. Both the flash and the controller are in 8D-8D-8D before the failing reads. We will still try mx66_sim133ddr.bin and share the result. Also, as suggested, we will also repeat the reads at lower clock frequencies, keeping the other properties consistent, and report any change in the data or error pattern. We will also capture oscilloscope images of SCLK, DQS and SIO[0:7] during the read-ID and failing read operations, and get back to you with them soon. Regards, Dheeraj Re: S32G399A octal DTR reads fail with Macronix MX66UM2G45G QSPI flash Hi Dheeraj, Thank you for the additional test results. Our initial responses to your first questions are provided below. Based on the information currently available, please consider the following: 1. As you know, the validated S32G3 controller configuration for 133 MHz DDR is documented in Table 54 of the S32G3 Data Sheet, under the “DDR-133MHz” column. This configuration uses external DQS. The “two clocks then zeros” behavior is compatible with a problem in the DQS path, but we cannot confirm it as a definitive symptom without reviewing the waveforms. Since external DQS fails with the same pattern from 133 MHz down to 66.7 MHz, while internal DQS works with manual delay settings, a board-level DQS signal or timing issue remains a reasonable possibility.
2. DLLCRA is used to generate the quantized delay. However, we do not currently have a validated DLLCRA value that can be recommended to correct the one-clock skew on your custom board. Internal DQS may be useful as a diagnostic, but external DQS remains the recommended configuration for DDR-133 operation. 3. Please use the recommended DDR-133 settings in the S32G3 Data Sheet as the controller reference. The mx66_sim133ddr.bin image is expected to have been verified by the software team, but the validation board and detailed test conditions are not currently available. You may open the image with the QuadSPI Configuration Tool in S32DS to inspect the configuration.
4. The BSP implementation needs to be checked. In addition, the AHB read sequence must match the protocol currently used by the flash. If the flash is in 1-1-1 mode while the AHB path is configured for an octal DTR sequence, a fault or hang can occur. For 1-1-1 operation, the AHB LUT and flash state must be configured consistently. 5. The current BSP device-tree configuration is intended for the MX25UW51245G used on the RDB3. When a different flash device is selected, the user is expected to update the device-tree and flash configuration as needed. At this time, I cannot confirm a planned BSP release that will add the MX66UM2G45G or provide board-specific validated Octal DTR parameters. I have already requested oscilloscope captures of SCLK, DQS, and SIO[0:7] during the read-ID and failing read operations. Please share those captures when available. They will be important for determining whether the external DQS signal is reaching and being sampled correctly. If the captures show that additional measurements are needed, I will let you know. The relevant references are the S32G3 Data Sheet and the QuadSPI Configuration Tool in S32DS. AN13563 may help explain the reconfiguration-image structure and generation flow, but its examples should not be treated as a direct validation for this S32G399A and MX66UM2G45G combination.
Best regards, Aldo.
View full article