AM62L: write operations to the MRAM via OSPI

Part Number: AM62L

Tool/software:

Hello,

We want to use the custom board of the AM62L to perform read and write operations to the MRAM via OSPI.
Processor SDK version is 11.00.15.05. Our device tree file is as follows.

&ospi0 {
	status = "okay";
	pinctrl-names = "default";
	pinctrl-0 = <&mram_pins_default>;

	mram: s3a4004r0m@0 {
		compatible = "netsol,s3a4004r0m", "jedec,spi-nor";
		reg = <0>;
		spi-tx-bus-width = <4>;
		spi-rx-bus-width = <4>;
		spi-max-frequency = <25000000>; /* 25MHz */
		cdns,read-delay = <4>;
		cdns,tshsl-ns = <60>;
		cdns,tsd2d-ns = <60>;
		cdns,tchsh-ns = <60>;
		cdns,tslch-ns = <60>;
	};
};

The datasheet of the MRAM we want to use requires that the CS remains asserted throughout a single transaction until it is completed.

However, the actual waveform output from the custom board is as follows.


- After the command, the CS is turned OFF once.

- After the data transmission, the next command and address are immediately sent out.

- Then no data is sent, there is a waiting period, followed by sending the command again, waiting again, then sending the command, address, and data.

This difference causes problems with writing,
Even though I intended to write zeros to mtd0, 0xa5 is written at every 256-byte boundary.

dd if=/dev/zero bs=1024 count=1 | tr "\000" "\377" > test.bin
dd if=./test.bin of=/dev/mtd0 bs=1024 count=1

# hexdump /dev/mtd0
0000000 ffff ffff ffff ffff ffff ffff ffff ffff
*
00000f0 ffff ffff ffff ffff ffff ffff ffff a5ff
0000100 ffff ffff ffff ffff ffff ffff ffff ffff
*
00001f0 ffff ffff ffff ffff ffff ffff ffff a5ff
0000200 ffff ffff ffff ffff ffff ffff ffff ffff
*
00002f0 ffff ffff ffff ffff ffff ffff ffff a5ff
0000300 ffff ffff ffff ffff ffff ffff ffff ffff
*
00003f0 ffff ffff ffff ffff ffff ffff ffff a5ff
0000400

I think the driver needs to be modified; how should I go about doing this?

Best regards,

Takayuki

  • Hello Takayuki-san,

    I will ping an OSPI expert. Please expect his reply in 1-2 days.

    Thank you,

    Stan

  • Thank you for your kind cooperation.
    By analyzing the data in more detail, it was found that the signals are sent in the following order.
    CMD(WREN)
    CMD(WREN), CMD(WR), ADDR, DATA
    CMD(WREN), CMD(WR), ADDR
    CMD(WREN)
    CMD(WREN), CMD(WR), ADDR, DATA
    CMD(WREN), CMD(WR), ADDR
    ...
    By enabling WEL_DIS_FLD (8) of the OSPI_FLASH_CFG_DEV_INSTR_WR_CONFIG_REG, it was possible to remove WREN as shown below.
    CMD(WREN)
    CMD(WR), ADDR, DATA
    CMD(WR), ADDR
    CMD(WREN)
    CMD(WR), ADDR, DATA
    CMD(WR), ADDR
    We would like to remove the CMD(WR), ADDR that come after the CMD(WR), ADDR, DATA.
    Is there any way?
    Best regards,
    Takayuki
  • Hi Takayuki Okamoto-san,

    I looked into your request.

    Regarding de-assertion of the CS line during transactions currently I came across this hint - i2351 description from the AM62Lx Sitara Processors Silicon Errata:

    I'll try to reach out to a TI OSPI Linux software expert regarding your question on the driver modification and command sequence optimization. Please expect that some delay is possible.

    Thanks for your patience !

    Kind Regards

    Anastas Yordanov