AnsweredAssumed Answered

SPI issue with K70 using PE and mqx lite

Question asked by Lee Penn on Feb 7, 2013
Latest reply on Apr 7, 2013 by angel gutierrez


I have a project in which I have initialized an spi port, My code using the SendBlock only has the CS and clock work for two bytes. When data size is set higher it leaves the CS and CLOCK low. See code below,

 

Task

  void PowerChip_task(uint32_t task_init_data)

  {

    int counter = 0;

    PowerChip_SPI_Init(PowerChip_SPI_DeviceData);

 

  PowerChip_InitSPI();

  while(1) {

      counter++;

       

    /* Write your code here ... */

      PowerChip_ReadSPI();

    }

  }

 

 

void PowerChip_InitSPI(void)

  {

         LDD_TError SPI_Error=0;

         int counter = 0;

 

       POWER_CHIP_SPI_DATA8_STRUCT DummyWrite={0xF};

 

   DummyWrite.OperationType=SPI_Write_Byte;

   DummyWrite.RegisterAddrLSB=SPI_DummyAddress>>1;

   DummyWrite.RegisterAddrMSB=SPI_DummyAddress>>8;

 

      //Initialize DIO reset of Power Chip

   PowerChip_Reset_Init(PowerChip_Reset_DeviceData);

  //Toggle reset of Power Chip

   PowerChip_Reset_ClrVal(PowerChip_Reset_DeviceData);

   _time_delay_ticks(50);

   PowerChip_Reset_SetVal(PowerChip_Reset_DeviceData);

   _time_delay_ticks(50);

 

         while (counter < 3)

        {

        SPI_Error=PowerChip_SPI_SendBlock(PowerChip_SPI_DeviceData,&DummyWrite,sizeof(DummyWrite));

                     if(SPI_Error>0)

               {

                                break;

               }

        ++counter;

        }

}

 


 

 

 

Outcomes