SPI transmission Issue in MM9Z1_638 battery sensor

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

SPI transmission Issue in MM9Z1_638 battery sensor

608 Views
prathapa_reddy
Contributor I

HI 

   i am working mm9z1-638 battery sesnor.I need to interface the SPI with external flash which supports SPI communication.I found the sample SPI demo code, with that i can able to read the standard registers(Manufacturer id and device id) of flash memory properly.If i want to write some bytes of information in the particular address then it is not happening.So i want to know the reason about the issue.Below i am attaching the two APIS i am using for transfer the data through SPI.

void SPIInit(void) {
SPICR1_LSBFE =0; //MSB first
SPICR1_SSOE = 0; //SSb enabled
SPICR1_CPHA = 0; //Mode 1 SPI
SPICR1_CPOL = 0; //Mode 1 SPI
SPICR1_MSTR = 1; //Master mode
SPICR1_SPTIE = 0; //SPTEF Interrupt disabled
SPICR1_SPIE = 0; //SPI interrupt disabled (use polling)

SPICR2_XFRW = 0; //16-bit data width
SPICR2_MODFEN =0; //SSb enabled
SPICR2_BIDIROE = 0; //Normal mode
SPICR2_SPISWAI = 1; //Stop SPI clock in Wait mode
SPICR2_SPC0 = 0; //Normal mode

SPIBR = 0x00; //4Mbit/s baud rate for 32MHz bus clock : MC33879 recommended baud rate
//SPISR=0x00;
}

this the configuration i did for the SPI with master mode.

u16 SPITransfer16bit2(u8 u16Data)

this the API i am using for transmitting the data.

please give me the reason for the issue and suggest me how to over come the issue.

0 Kudos
1 Reply

499 Views
lama
NXP TechSupport
NXP TechSupport

Hi, if you are able to read the external SPI flash then you have also to be write to it. Standard suggestion is to put all signals to the scope and check whether I can see communication in the form which is expected by device I communicate with. You really have to check communication protocol and timing by scope and compare it with requirement given by flash memory datasheet.

Best regards,

Ladislav

0 Kudos