This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM2434: SFPD Flash Driver Support in AM243x MCU+ SDK08.06.00.43

Part Number: AM2434
Other Parts Discussed in Thread: UNIFLASH, SYSCONFIG

Hi expert,

     I have question about Flash driver setting on AM2434 GP EVM. 

1. I run ospi_flash_diag demo project to get SFDP data from default FLASH S28HS512T.  Then I create json file for S28HS512T

[MAIN_Cortex_R5_0_0] [OSPI Flash Diagnostic Test] Starting ...
[OSPI Flash Diagnostic Test] Flash Manufacturer ID : 0x34
[OSPI Flash Diagnostic Test] Flash Device ID       : 0x5B1A
[OSPI Flash Diagnostic Test] Executing Flash Erase on first block...
[OSPI Flash Diagnostic Test] Done !!!
[OSPI Flash Diagnostic Test] Performing Write-Read Test...
[OSPI Flash Diagnostic Test] Write-Read Test Passed!
[QSPI Flash Diagnostic Test] SFDP Information : 
================================================
                      SFDP                      
================================================
SFDP Major Revision                       : 0x1
SFDP Minor Revision                       : 0x8
Number of Parameter Headers in this Table : 6

Types of Additional Parameter Tables in this flash
---------------------------------------------------
4 BYTE ADDRESSING MODE INSTRUCTIONS TABLE
NOR SPI PROFILE TABLE 
STATUS CONTROL AND CONFIGURATION REGISTER MAP TABLE
OCTAL DDR MODE COMMAND SEQUENCE TABLE
SECTOR MAP TABLE

Parsing of OCTAL DDR MODE COMMAND SEQUENCE TABLE table not yet supported. 
JSON Data for the flash :

{

	"flashSize": 67108864,
	"flashPageSize": 256,
	"flashManfId": "0x34",
	"flashDeviceId": "0x5B1A",
	"flashBlockSize": 262144,
	"flashSectorSize": 4096,
	"cmdBlockErase3B": "0xDC",
	"cmdBlockErase4B": "0xDC",
	"cmdSectorErase3B": "0x21",
	"cmdSectorErase4B": "0x21",
	"protos": {
		"p111": {
			"isDtr": false,
			"cmdRd": "0x03",
			"cmdWr": "0x02",
			"modeClksCmd": 0,
			"modeClksRd": 0,
			"dummyClksCmd": 0,
			"dummyClksRd": 0,
			"enableType": "0",
			"enableSeq": "0x00",
			"dummyCfg": null,
			"protoCfg": null,
			"strDtrCfg": null
		},
		"p112": null,
		"p114": null,
		"p118": null,
		"p444s": null,
		"p444d": null,
		"p888s": null,
		"p888d": {
			"isDtr": true,
			"cmdRd": "0xEE",
			"cmdWr": "0x12",
			"modeClksCmd": 0,
			"modeClksRd": 0,
			"dummyClksCmd": 4,
			"dummyClksRd": 24,
			"enableType": "0",
			"enableSeq": "0x00",
			"dummyCfg": {
				"isAddrReg": true,
				"cmdRegRd":"0x65",
				"cmdRegWr":"0x71",
				"cfgReg":"0x00800003",
				"shift":0,
				"mask":"0x03",
				"bitP":11
			},
			"protoCfg": {
				"isAddrReg": true,
				"cmdRegRd": "0x65",
				"cmdRegWr": "0x71",
				"cfgReg": "0x00800006",
				"shift": 0,
				"mask": "0x00",
				"bitP": 0
			},
			"strDtrCfg": {
				"isAddrReg": true,
				"cmdRegRd": "0x65",
				"cmdRegWr": "0x71",
				"cfgReg": "0x00800006",
				"shift": 1,
				"mask": "0x00",
				"bitP": 1
			}
		},
		"pCustom": { 
			"fxn": null
		}
	},
	"addrByteSupport": "1",
	"fourByteAddrEnSeq": "0xA0",
	"cmdExtType": "REPEAT",
	"resetType": "0x10",
	"deviceBusyType": "1",
	"cmdWren": "0x06",
	"cmdRdsr": "0x05",
	"srWip":  0,
	"srWel":  1,
	"cmdChipErase": "0xC7",
	"rdIdSettings": {
		"cmd": "0x9F",
		"numBytes": 5,
		"dummy4": 0,
		"dummy8": 0
	},
	"xspiWipRdCmd": "0x65",
	"xspiWipReg": "0x00800000",
	"xspiWipBit": 0,
	"flashDeviceBusyTimeout": 256000000,
	"flashPageProgTimeout": 512
}

All tests have passed!!
{

	"flashSize": 67108864,
	"flashPageSize": 256,
	"flashManfId": "0x34",
	"flashDeviceId": "0x5B1A",
	"flashBlockSize": 262144,
	"flashSectorSize": 4096,
	"cmdBlockErase3B": "0xDC",
	"cmdBlockErase4B": "0xDC",
	"cmdSectorErase3B": "0x21",
	"cmdSectorErase4B": "0x21",
	"protos": {
		"p111": {
			"isDtr": false,
			"cmdRd": "0x03",
			"cmdWr": "0x02",
			"modeClksCmd": 0,
			"modeClksRd": 0,
			"dummyClksCmd": 0,
			"dummyClksRd": 0,
			"enableType": "0",
			"enableSeq": "0x00",
			"dummyCfg": null,
			"protoCfg": null,
			"strDtrCfg": null
		},
		"p112": null,
		"p114": null,
		"p118": null,
		"p444s": null,
		"p444d": null,
		"p888s": null,
		"p888d": {
			"isDtr": true,
			"cmdRd": "0xEE",
			"cmdWr": "0x12",
			"modeClksCmd": 0,
			"modeClksRd": 0,
			"dummyClksCmd": 4,
			"dummyClksRd": 24,
			"enableType": "0",
			"enableSeq": "0x00",
			"dummyCfg": {
				"isAddrReg": true,
				"cmdRegRd":"0x65",
				"cmdRegWr":"0x71",
				"cfgReg":"0x00800003",
				"shift":0,
				"mask":"0x03",
				"bitP":11
			},
			"protoCfg": {
				"isAddrReg": true,
				"cmdRegRd": "0x65",
				"cmdRegWr": "0x71",
				"cfgReg": "0x00800006",
				"shift": 0,
				"mask": "0x00",
				"bitP": 0
			},
			"strDtrCfg": {
				"isAddrReg": true,
				"cmdRegRd": "0x65",
				"cmdRegWr": "0x71",
				"cfgReg": "0x00800006",
				"shift": 1,
				"mask": "0x00",
				"bitP": 1
			}
		},
		"pCustom": { 
			"fxn": null
		}
	},
	"addrByteSupport": "1",
	"fourByteAddrEnSeq": "0xA0",
	"cmdExtType": "REPEAT",
	"resetType": "0x10",
	"deviceBusyType": "1",
	"cmdWren": "0x06",
	"cmdRdsr": "0x05",
	"srWip":  0,
	"srWel":  1,
	"cmdChipErase": "0xC7",
	"rdIdSettings": {
		"cmd": "0x9F",
		"numBytes": 5,
		"dummy4": 0,
		"dummy8": 0
	},
	"xspiWipRdCmd": "0x65",
	"xspiWipReg": "0x00800000",
	"xspiWipBit": 0,
	"flashDeviceBusyTimeout": 256000000,
	"flashPageProgTimeout": 512
}
 

2. in sbl_uart_uniflash project, I create new customized configuration as

Load json file I got before. ( I use syscfg-tool 1.16 instead of default 1.14 since 1.4 has issue)

3. recompile it and use it as new flash writer. to program default sbl_null image.

However, the new sbl_uart_uniflash image doesn't work. 

4. I compare the difference between default flash driver setting and load from json file. I find several setting are different.

I highlight here:

The dummy cycles setting, protocol enable configuration setting and register bit/bit mask are different then default. 

4. I change back default setting and recompile it again, then every thing fine. 

Question here. 

1. Why default setting is deferent than result got from SFPD table? Which one match the FLASH datasheet description?

2. Automatically syscfg generated from "LOAD SFPD" json file doesn't work?

Regards

Andre  

  • Hi ,

    The SFDP values, configuration by the driver might be working on different SFDP versions. This is the reason why we created an FAQ to support manually adding and understanding these configurations while doing so.

    Link to the FAQ - https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/1230063/faq-mcu-plus-sdk-am243x-faq-how-to-debug-develop-migrate-the-flash-driver-for-custom-flash-on-non-ti-evm-ospi-xspi

    This will enable your flash in one of the fastest ways, without you having any dependency over TI support.

    Hope it helps.

    Best Regards,
    Aakash

  • 1.  So how do I know which version of SPFD is workable?

    2. The default flash S28HS512T does support SPFD, why the method in your FAQ doesn't work on EVM??

    3. Any workable SPFD driver can be demo by EVM or Launchpad?

    Regards

    Andre 

     

  • Hi AndreTseng,

    Please find the details here - https://software-dl.ti.com/mcu-plus-sdk/esd/AM243X/latest/exports/docs/api_guide_am243x/CUSTOM_FLASH_SUPPORT_GUIDE.html

    1. Working at very high operating frequency, the dummy cycles even though suggested by datasheet might not work. Hence by experimentation, this is devised which value will be the apt.

    2. Its not it does not work with SFDP of EVM. The thing is that these information is best taken from datasheet. The CMDs of read and write will be part of SFDP table but "bit level information" might not be presented. But rest all of the data which is filled, is mostly correct and according to the spec.

    So datasheet is the best place to revert back if things stops working because of these configurations.

    The FAQ is written in the simplest ways, where users exactly knows what are the changes that are being done.

    Best Regards,
    Aakash

  • Askash,

       Would you mind to close the issue after both of us agree issue is solved?

    I still have a lot questions need to provide answer to customers :

    1. On which EVM, we load json git from opsi_flash_diag demo work directly without modification?? How do we verify this function is workable?

    2. In the report of ospi_flash_diag: The "bitP" :11  is binary 0b11 or decimal 11?

    "dummyCfg": {
    "isAddrReg": true,
    "cmdRegRd":"0x65",
    "cmdRegWr":"0x71",
    "cfgReg":"0x00800003",
    "shift":0,
    "mask":"0x03",
    "bitP":11

    if this value is decimal 11 / 0b1011 Dummy cycle is set to 24.


    Looks like default setting 25 is conflict then register setting.

    And mask value in json is 0x00, is wrong. 

    "protoCfg": {
    "isAddrReg": true,
    "cmdRegRd": "0x65",
    "cmdRegWr": "0x71",
    "cfgReg": "0x00800006",
    "shift": 0,
    "mask": "0x00",
    "bitP": 0
    },
    "strDtrCfg": {
    "isAddrReg": true,
    "cmdRegRd": "0x65",
    "cmdRegWr": "0x71",
    "cfgReg": "0x00800006",
    "shift": 1,
    "mask": "0x00",
    "bitP": 1

    How can we trust result from ospi_flash_diag? 

    Regards

    Andre

  • I also want to know where this 133MHZ coming from

    According to TRM, OSPI_RCLK coming from MAIN_PLL0_HSDIV1_CLKOUT or MAIN_PLL1_HSDIV5.


    They should be 200MHz and 160MHz.

    So where is this 133MHz coming from?

    Regards

    Andre

  • Hi Andre,

    In K3 architecture, the clocks are enabled and configured via TISCI services -

    Do you need more details ? The clocking is very abstracted and handled directly via TISCI.

    Best Regards,
    Aakash

  • Yes, I do need know exactly where this 133MHz coming from. Even using the TISCI to request and configuration, chip hardware still have its coming source. 

    like MAIN_PLL0_HSDIV1 is coming from 2000Mhz and divide 10 So it is 200Mhz.  Unless the TRM manual is wrong or TISCI configuration just don't follow the TRM and set different value. 

    I didn't get answer why SFPD report from ospi_flash_diag demo project doesn't work. What platform we can verify the load SFPD json works?

     Can you please provide  answer?

    Regards

    Andre

  • Yes, I do need know exactly where this 133MHz coming from. Even using the TISCI to request and configuration, chip hardware still have its coming source. 

    like MAIN_PLL0_HSDIV1 is coming from 2000Mhz and divide 10 So it is 200Mhz.  Unless the TRM manual is wrong or TISCI configuration just doesn't follow the TRM and set different value. 

    I didn't get answer why SFPD report from ospi_flash_diag demo project doesn't work. What platform we can verify the load SFPD json works?

     Can you please provide  answer?

    Regards

    Andre

  • From TRM I got answer the 133MHz coming from. 

    Please provide the answer which workable platform we use for "SFPD autoload from json" verification. 

    Regards

    Andre 

  • Hi Andre,

    Since you're now clear about the clocking spec, I will explain about the JSON load feature.

    The backend of JSON load button in sysconfig is just a JSON parser. Whatever JSON file is given, the backend will update the configurables based on the values read from the file. So it boils down to the JSON file. Now for generating this file, we have the example application / tool called the ospi_flash_diag. The diag uses SFDP (Serial Flash Discoverable Parameters) feature of the flashes to get data about the flash. Now SFDP is not the most standardized of tables. When it comes to NOR/NAND flashes there might be a lot of vendor specific idiosyncrasies. This is why supporting custom flashes become a challenge. 

    To your question as to why the S28HS512T.json which the flash diag generates is different from what you see, like I said now and mentioned in the custom flash guide, some things like dummy cycles and write delays will need one more level of tweaking. We want the OOB configuration to work, that's why we give the working configuration.

    If you're using the default flash, may I know why you want to go through the custom flash support procedure when there is OOB support already?

    Regards,
    Anand Mahadevan SS

  • Anand,

        Thanks for your reply. 

    1. Why customer use EVM to verify customer flash support procedure: 

         Before customer start to customize their own design, of course they want to check if the function provided by TI is work. The default FLASH supports SFPD. They do think we implement this support feature on our EVM. Check if it works then select other SPFD supported FLASH base on price or their need which can minimize their porting effort.  It's a reasonable procedure. I don't think this is strange requirement. If json load can't work on TI EVM, if you are customer, will you accept it?   

    2. From SFPD reports and Flash datasheet, the read dummy cycles for 8D-8D-8D protocol is 24. The default setting uses 25. I can't explain why on our device, we can't follow the FLASH datasheet and need to use try and error experience. Is FLASH datasheet has issue? or OSPI controller wrong?

    May I have your comment? 

    3. More questions I can't explain to customer:

    a. In TRM, we have a block diagram for read capture. We can't find OSPI_ICLK this pin, we guess this pin is OSPI_LOOPLBCLKO. Can you please confirm?

    b.  We also want  to check the scheme of read capture by taps on EVM by disable PHY mode.

            We modify ospi_flash_io_am243x-evm_r5fss0-0_nortos_ti-arm-clang syscfg so that input clock source is 100MHz and divider is 4. 

            Base on calculation, OSPIO_CLK is 25MHz. And demo code runs well on EVM.

            However, we change the OSPI_RCLK to 200Mhz and divider is 8. The test result is failed. We look into flash_nor_ospi.c, we found the issue happens on  Flash_norOspiReadId(). The read data is not correct.  That surprise us. So we do some more test.  first we modify readDataCapDelay from 4  to 15 in Flash_norOspiOpen(). Recompiled driverlib, and try different combination. 

    Here is the table to show the result:

    From the result, we know external OSPI clock can work with 100MHz with divider set to 4. However, if we choice divider other than 4, none of them works. We can not figure out what the problem coming from. All of them fail in read chip id.

    Even OSPI_OCLK is 25MHz, we can't tell why RCLK=100MHz/Divider=4 works but RCLK=200MHz/Divider=8 doesn't. What make them different?

    2. Why there are two factor can inference the capture point, SMAPLE_EDGE_SEL_FLD and  DELAY_FLD in OPSI _RD_DATA_CAPTURE_REG

    Question, why we only adjust DELAY_FLD only in our driver?

    c. In the block diagram, If we enable PHY, it looks like RX data from external won't pass through to taps/sample edge select block diagram.

    But in source code,  ospi_phy.c OSPI_phySetRdDelayTxRxDLL(), we set both of these two bit fields in PHY tuning procedure. Customer requests we provide correct information. They don't think the TRM is correct.

    All of these questions I can't answer. And it is easy to reproduce on AM2434 EVM. Can you please help?

    Regards

    Andre

     

     

  • Hi Andre,

    1. As I have explained before, supporting custom flash via SFDP and JSON load is not a sure shot method, because it is highly flash dependent and vendors don't agree on the standards very rigidly. Everybody makes it a little different. SFDP can only help to a point. The JSON data generated by ospi_flash_diag using SFDP is read directly from the flash. So if there is a mistake in that, probably the data in the flash is wrong. Even if it is not, the timing requirements in Octal SPI at higher speeds are tricky, so there will be some manual intervention required. More often than not, the datasheet of the flash would be more accurate, that's why we mention in the guide to cross check the generated values with the datasheet once. For the flash in the EVM this was the case. A bit of manual tweaking was required to get it to work. These changes were then added back to the JSON file so that if somebody wants to start working on that particular flash they can directly load that file instead of running the flash diagnostic again.

    2. I think I have answered this question above. It is possible that the information in SFDP table was incorrect, or maybe due to change in some other conditions we had to increase/decrease the recommended dummy cycle value. It doesn't mean that it's a mistake on anybody's part. Bringing up an external flash can be tricky like that. Anyway, this is a one time setup. And once we have the working configuration we can save it. That's what we have done for the S28HS512T flash.

    3. a. You're right, the LBCLK is not an exposed pin. That's why you couldn't find it. Diagram is from an IP POV. Needn't worry I would say.

    3. b. Read capture by taps is a slightly complicated topic. It is not fully explained in the TRM. I will try to explain as much as I understand. The divider value is equal to the number of tap points. That is, if the divider value is 4, there are 4 tap points. The read capture delay is how we adjust the shifting of these taps, as shown in the diagram. If there are only 4 tap points, 0 delay would mean first tap point, 1 delay would mean second tap point and so on. In this case 4 delay means you've shifted the clock one full cycle. To adjust that it's better to use the dummy cycles. RD Capture delay is fine tuning on top of that. You mention that 200/8 configuration initially didn't work. That's probably because of this RD capture delay setting. I am not sure if this mentioned in the documentation or sysconfig, but the recommended value of clock div is 4. And if you do change the RD capture delay sweep to 0-7, the 200/8 should have worked. Nevertheless, I don't see why 100/4 configuration is not usable.

    4. I think I have explained the delay field above. And I hope it's clear why there's a need to adjust this. Regarding sampling edge selection, I need to come back on the clarification but if I remember correctly, this can be either value when the capture method is taps and when using PHY it always needs to be falling edge. I will check and confirm this. 

    4. a. Yes, in PHY mode taps are bypassed, but if I remember correctly there is a constant shift value of 25% of the clock mentioned in the IP spec, which is why we have to loop through 0-3 tap points for RD capture delay even in PHY mode. I hope the answers are clear.

    My recommendation is to use the default driver configuration unless there is a specific need to adjust these. Let me know if there are any more concerns.

    Regards,
    Anand Mahadevan SS

  • Anand

    3b. Unfortunately, all the combination of RD capture delay, RCLK and Divider are not work if DIVIDER !=4 on EVM. Customer request more clear information for reading capture. the timing relationship between SPI MODE, read capture edge, and read capture delay. 

    4a. Please provide correct block diagram to show how to loopback  from PHY module.

      

    Basically, the wrong block diagram make a lot of trouble to field team, Please help to provide correct one.

    The target to them is not just a workable driver. They want to push performance more so they need to understand very clearly.

    Regards

    Andre

  • Hi Andre,

    Let me check with some more experts and come back on this. I will try to get some references on the spec which I explained.

    Regards,
    Anand M

  • Anand,

       Any update?

    Regards

    Andre

  • Hi Andre,

    I need some more time to check on this, there are some discrepancies in the spec. But I think meanwhile they can start the development with the current available driver, we have tested it for maximum performance, at 200 MHz with PHY and DMA enabled.

    Regards,
    Anand Mahadevan SS