MISO line shows correct data in oscilloscope, But not updating in receive buffer

cancel
Showing results for 
Search instead for 
Did you mean: 

MISO line shows correct data in oscilloscope, But not updating in receive buffer

469 Views
priya_p
Contributor IV

MPC5748G (Master) is communicating with NAND Flash  W25N01GV (Slave) via SPI. When ever I am sending command from MPC, nand flash is giving the correct response and it was validated by capturing the wave using oscilloscope.

The response is the correct one and signal quality was also good. MISO line shows correct data in oscilloscope, But not updated in receive buffer in the code. When checked in POPR, RXFIFO registers also, no data was present at all. What could be the reason for this?

I am attaching the waveforms from the datasheet of NAND FLASH for the command I used.

0 Kudos
10 Replies

464 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

which pin do you use for SIN (MISO)? Do you properly set respective MSCR and IMCR (if needed) registers?
What kind of code you are using.

BR, Petr

0 Kudos

461 Views
priya_p
Contributor IV

which pin do you use for SIN (MISO)?

I am using SPI_0 and PI[14] (i.e pin number 76) is configured as MISO pin.

Do you properly set respective MSCR and IMCR (if needed) registers?

I haven't configured it separately but during pin initialization I guess it will be set as per configuration.  

What kind of code you are using?

I am using spi driver file generated by s32ds and below provided function is called for transmission.

status_t SPI_MasterTransfer(const spi_instance_t * const instance, const void* txBuffer, void* rxBuffer, uint16_t numberOfFrames);

 

0 Kudos

434 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

even for SDK used, check respective MSCR/IMCR registers (it should be MSCR[142] and IMCR[300])
Be sure MISO line is really connected to the right pin.
Function definition does not say how it is used in your code. Anyway if correct frame is transmitted, slave response is visible on MISO line, and nothing is also seen in RXFIFO, i would expect wrong pin setting or usage.

BR, Petr  

0 Kudos

367 Views
priya_p
Contributor IV

MISO line is connected to the right pin. I have cross checked it.  I guess MSCR and IMCR is configured in the right way. MSCR[SSS] is 00000010, so input mux[0] is assigned value 2 and input_mux_reg[0] is assigned 300. input mux_1 to 7 are disabled. Also for the SPI input pin of MCU, HYSTERESYS, pull select and open drain are disabled. Do i need to modify any of these to receive data properly. If i am wrong, please do correct me.

0 Kudos

356 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

if PI[14] pin is used as SIN then below setting is expected
MSCR[142] IBE bit set
IMCR[300] SSS=2

Hysteresis can be enabled, weak pullup or pull down too, as memory does not drive the output during command and dummy bytes.

BR, Petr 

0 Kudos

349 Views
priya_p
Contributor IV

Yes I am using PI[14] pin as SIN.  I have already checked and MSCR[142] IBE bit set and IMCR[300] SSS=2.

 

0 Kudos

345 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

ok, then share real SPI signals measurement by scope/analyzer (CS, SCLK, SOUT, SIN) and equivalent code used for it, i.e. not the function definition.

BR, Petr

0 Kudos

340 Views
priya_p
Contributor IV

priya_p_0-1643698090341.png

blue: SIN line to MCU

yellow: CLOCK FROM MCU TO EXT.SPI DEVICE

priya_p_1-1643698358710.png

 

0 Kudos

319 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

attached is modified demo code to use SPI_0 to send 5 bytes with continuous selection.
On DEVKIT board I connect SOUT to SIN to check reception on PI[14] pin.
It works well. This is what I see...

PetrS_4-1643793414481.png

PetrS_5-1643793421618.png

Receive buffer has the same data what is sent.

Below pins are used, so can be connected on DEVKIT easily

PetrS_6-1643793436854.png

BR, Petr

 

0 Kudos

309 Views
priya_p
Contributor IV

Thank you so much for the continuous reply as well as for the code. I will try to connect sout to sin.  

0 Kudos