AnsweredAssumed Answered

SPI transmission Issue in MM9Z1_638 battery sensor

Question asked by prathapreddy pacharapalli on Jun 14, 2019
Latest reply on Jun 18, 2019 by lama

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.

Outcomes