Shift in SPI Rx Buffer MKL17Z256

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Shift in SPI Rx Buffer MKL17Z256

796 Views
samc
Contributor III

Hello,

 

I use the SPI of the MKL17Z256VFT4 and I have a question about the received char, in fact I have a 1 byte shift in my received buffer.

The MCU communicate with a S25FL116K0XNF1011 FLASH memory. I simply send the JEDECID 0x9F command to read the manufacturer ID (0x01), the device type (0x40) and the capacity (0x15) according to the datasheet.

 

Here the code who read these values :

 

FLA_TxBuffer_U8A[0] = cFLA_JEDECID_U8;

GPIO_DRV_WritePinOutput(CS_SPI , 0);

SPI_DRV_MasterTransferBlocking(spiCom1_IDX, &spiCom1_MasterConfig0, FLA_TxBuffer_U8A, FLA_RxBuffer_U8A, 4, 100);

GPIO_DRV_WritePinOutput(CS_SPI , 1);

 

As you can see I have a Rx Buffer named FLA_RxBuffer_U8A which is an array of 6 bytes.

 

After these lines was executed, in the buffer I have this :

 

154194_154194.pngpastedImage_0.png

 

I found the 3 correct values, but why these values don't begin at the value FLA_RxBuffer_U8A[0]  but at ....[1] ?

 

I tried with 3 instead of 4 for the 5th argument of the read function (transfertByteCount) but I d'ont received the 0x15 in this case.

 

Thank you,

 

Sam

Labels (1)
0 Kudos
3 Replies

471 Views
samc
Contributor III

Hi,

OK in fact that's a dummy byte read by the MCU when he send the commande byte 0x9F ? as there is a clock pulse during this command sending, the MISO read at the same time , it's right ?

0 Kudos

471 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi,

Yes, it is dumy byte, SPI uses the same clock to read and write.

BR

XiangJun Rong

0 Kudos

471 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi, Samuel,

I do not check the data sheet of the S25FL116K0XNF1011 FLASH memory. But from first look, as you know,  the SPI uses synchronized transfer for transmitter and receiver, in other words, after the SPI transmits the command 0x09, it receives the 0x00 at the same time(the received 0x00 is a dummy data), after the command 0x09 is received by flash, the SPI will receive the response sequence as 0x01, 0x40...from flash.

Hope it can help you.

BR

XiangJun Rong

0 Kudos