SPI issue with K70 using PE and mqx lite

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

SPI issue with K70 using PE and mqx lite

ソリューションへジャンプ
2,216件の閲覧回数
leepenn
Contributor III


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;

        }

}


0 件の賞賛
返信
1 解決策
1,755件の閲覧回数
Petr_H
NXP Employee
NXP Employee

Hi,

From your code, there seems to be missing some parts - there is no wait for end of the transfer.

Please see the help for the component (e.g. using pop-up menu command Help on Component") , the Typical usage page. It contains example of basic usage with and without using interrupts.

Your code in PowerChip_InitSPI passes a reference to local variable which might be a problem when the function ends but the sending would continue.

We have tested transfer of four bytes using your settings and it worked properly. We recommend to also check the bus if there is no other influence disturbing the communication.

best regards

Petr Hradsky

Processor Expert Support Team

元の投稿で解決策を見る

0 件の賞賛
返信
6 返答(返信)
1,755件の閲覧回数
Petr_H
NXP Employee
NXP Employee

Hi,

Could you please post a simple project with component and its settings ? It's not clear how the component and the CPU is configured.

best regards

Petr Hradsky

Processor Expert Support Team

0 件の賞賛
返信
1,755件の閲覧回数
leepenn
Contributor III

Here is the component settings from PE.

0 件の賞賛
返信
1,756件の閲覧回数
Petr_H
NXP Employee
NXP Employee

Hi,

From your code, there seems to be missing some parts - there is no wait for end of the transfer.

Please see the help for the component (e.g. using pop-up menu command Help on Component") , the Typical usage page. It contains example of basic usage with and without using interrupts.

Your code in PowerChip_InitSPI passes a reference to local variable which might be a problem when the function ends but the sending would continue.

We have tested transfer of four bytes using your settings and it worked properly. We recommend to also check the bus if there is no other influence disturbing the communication.

best regards

Petr Hradsky

Processor Expert Support Team

0 件の賞賛
返信
1,754件の閲覧回数
Angelillo
Contributor III

Hi Lee,

Have you got MQX Lite on K70?? I have seen that MQX Lite is compatible with KL series only...

Thank you,

Angel G.

0 件の賞賛
返信
1,755件の閲覧回数
Petr_H
NXP Employee
NXP Employee

The MQX lite is not supported on K70. It's currently available only for Kinetis L.

On K family, there is only standard MQX, which offers PEx support when you customize the BSP project.

best regards

Petr Hradsky

Processor Expert Support Team

0 件の賞賛
返信
1,755件の閲覧回数
Angelillo
Contributor III

Ok Thank you very much Petr!

0 件の賞賛
返信