AnsweredAssumed Answered

SPI PT60

Question asked by Eliezer Oliveira Cardoso on Jan 27, 2016
Latest reply on Feb 4, 2016 by Stanislav Arendarik

Hello guys, I'm having problems with the CPI EN 60.

Below my boot code, reading and writing.

Also follows signal aspect I need to generate.

Thanks,

 

how to get my signal.

how to get my signal.PNG

 

like this my sign.

my signal.PNG

 

 

void SPI0_Init( void )

{

  volatile char dummy;

  SYS_SOPT1_SPI0PS  = 1;       

  SPI0_C1_MSTR = 1;        

  SPI0_C1_CPHA = 0;      

  SPI0_C2_MODFEN = 1;

  SPI0_C1_SSOE = 1;

  SPI0_BR = 0x73;

  dummy = SPI0_D;

  SPI0_C1_SPE  = 1;        

}

 

void Wr(unsigned char Address, unsigned char value)

{  

   SPI0_S |= SPI0_S_SPTEF_MASK;  

   SPI0_D = ( (Address<<1)&0x7E);

   while( !SPI0_S_SPRF );

  

   SPI0_S |= SPI0_S_SPTEF_MASK;  

   SPI0_D = value;  

   while( !SPI0_S_SPRF ); 

}

 

 

unsigned char Rd(unsigned char Address) 

{  

   unsigned char value,limpa;         

   SPI0_S |= SPI0_S_SPTEF_MASK;  

   SPI0_D = ((Address<<1)&0x7E)| 0x80;     

   limpa=SPI0_D;

   while(!SPI0_S_SPRF);

   value = SPI0_D;   

   return value;

}

Outcomes