Use a GPIO as CS to control SPIFI

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Use a GPIO as CS to control SPIFI

1,050件の閲覧回数
changlin_ren
Contributor II

Hello, I am working on a dev board(OM13098). My project is to use the on board serial flash (W25Q128JV-DTR) as a mass storage device through USB port. I combined two example projects together. (lpcxpresso54628_dev_msc_ramdisk_bm + lpcxpresso54628_spifi_polling_transfer) modified lpcxpresso54628_dev_msc_ramdisk_bm a bit in order to access SPI flash data

The test code worked OK on dev board for fast_read_qaud_out, fast_read_dual_out, fast_read, and standard_read. I can see the SCLK/CS/MOSI/MISO SPI signals through a logical analyzer. The pin configuration as following:

P0_23: SPIFI_CSN, 

P0_24: SPIFI_IO(0) - MOSI, 

P0_25: SPIFI_IO(1) - MISO, 

P0_26: SPIFI_CLK, 

P0_27: SPIFI_IO(3), 

P0_28: SPIFI_IO(2)

Now I need to port above code to our production board. On the board the main clock is 180MHz(the dev board is 220MHz), there are 4 SPI devices share the same SPI bus. SCLK/MOSI/MISO will be shared, each SPI device has it own CS. Also due to hardware limitation, SPIFI_IO(2:3) are not available to the firmware, I cannot use fast_read_quad_output.

The SPI flash pin configuration changed as following:

P2_14:GPIO output connect to SPI flash /CS pin,

P2_15: GPIO output connect to SPI flash /RESET pin

P3_15 FC8_SCK to flash chip CLK pin,

P3_16 FC8_RXD_SDA_MOSI to flash chip DI(IO0).

P3_17 FC8_TXD_SCL_MISO to flash chip Do(IO1)

In my code, I manually set P2_14 to 0 or 1, before and after write/read flash data, or sendCommands to the flash chip. I can see the /CS signals from logical analyzer. but I cannot see CLK and MOSI signals. MISO seems like repeats /CS signals.

What the possible mistakes I made can cause above issue? can you provide a detail steps from 

1. how to set Power: In the AHBCLKCTRL0 register

2. how to set SPIFI clock: set up the SPIFI clock using the SPIFICLKSEL and SPIFICLKDIV
registers

3. how to set Pins: Select SPIFI pins and pin modes through the relevant IOCON registers

I noticed that /CS(P2_14) does not on the same FlexComm as SCLK/MOSI/MISO(these 3 are on FC8), 

Does this pin config will work? or I need to change /CS to PIO3_18 FC8_CTS_SDA_SSEL0?

 

Thank you!

  

 

ラベル(1)
0 件の賞賛
返信
1 返信

1,024件の閲覧回数
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello,

Can not see  CLK signal, it meaning the SPIFI doesn't work, recommend you check the SPIFI clock configuration. You can use configuration tool inside MCUXpresso IDE config SPIFI refer to your own board clock and pins, then refer to the generated code.

 

BR

Alice

 

0 件の賞賛
返信