Error During Build (SPI Block) MBD for MPC5744P

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

Error During Build (SPI Block) MBD for MPC5744P

ソリューションへジャンプ
2,537件の閲覧回数
abhishek_kumar1
Contributor IV

Dear All

I experienced an error while building a model to Initialize FET Prediver (33937A). 

The build error seems to originate while using SPI Block. 

I have attached the error (MATLAB Diagnostic) in txt file as well as the model. 

pastedImage_1.png

Please let me know why this issue seems to be. 

Best Regards,

Abhishek

タグ(1)
1 解決策
2,301件の閲覧回数
constantinrazva
NXP Employee
NXP Employee

Hello abhishek.kumar@chassisbrakes.com‌,

I've found the problem:

In MPC5744.h, at line 17064, there is the following define

#define SPI_0                                    ((SPI_Type *)SPI_0_BASE)

At the same time, in the model you've sent me, the name of the SPI Master transfer block is SPI_0. A variable generated to be used as input/output for that block is named SPI_0, as MATLAB codegen has no idea that it should not use that exact name; it just puts the name of the block there. So this is what is actually going on.

typedef struct {
   uint8_T SPI_0; /* '<S2>/SPI_0' */
} B_FET_predriver_MC34GD3000;

void FET_predriver_MC34GD3000(uint8_T rtu_MPC_SPI_Data,
B_FET_predriver_MC34GD3000 *localB)
{
   /* S-Function (spi_mpc574x_master_transfer): '<S2>/SPI_0' */
   {
      DSPI_UpdateCS(0, 0);
      DSPI_MasterTransfer(0, &rtu_MPC_SPI_Data,
      &localB->SPI_0, 1U);
   }
}

Took a while to find the culprit, but the fix is simple - just rename the SPI Master transfer block from SPI_0 to something else (e.g: SPI_zero or SPI_00).

Please let me know if you have further issues with it.

Kind regards,

Razvan.

元の投稿で解決策を見る

5 返答(返信)
2,302件の閲覧回数
constantinrazva
NXP Employee
NXP Employee

Hello abhishek.kumar@chassisbrakes.com‌,

I've found the problem:

In MPC5744.h, at line 17064, there is the following define

#define SPI_0                                    ((SPI_Type *)SPI_0_BASE)

At the same time, in the model you've sent me, the name of the SPI Master transfer block is SPI_0. A variable generated to be used as input/output for that block is named SPI_0, as MATLAB codegen has no idea that it should not use that exact name; it just puts the name of the block there. So this is what is actually going on.

typedef struct {
   uint8_T SPI_0; /* '<S2>/SPI_0' */
} B_FET_predriver_MC34GD3000;

void FET_predriver_MC34GD3000(uint8_T rtu_MPC_SPI_Data,
B_FET_predriver_MC34GD3000 *localB)
{
   /* S-Function (spi_mpc574x_master_transfer): '<S2>/SPI_0' */
   {
      DSPI_UpdateCS(0, 0);
      DSPI_MasterTransfer(0, &rtu_MPC_SPI_Data,
      &localB->SPI_0, 1U);
   }
}

Took a while to find the culprit, but the fix is simple - just rename the SPI Master transfer block from SPI_0 to something else (e.g: SPI_zero or SPI_00).

Please let me know if you have further issues with it.

Kind regards,

Razvan.

2,301件の閲覧回数
abhishek_kumar1
Contributor IV

Dear constantinrazvan.chivu

Works like a charm.

Abhishek

0 件の賞賛
返信
2,301件の閲覧回数
lijiantaowy
Contributor III

Hello Abhishek Kumar,

When I use the MPC57XX MBD toolbox to configure SPI and communicate with power chip, the data structure required by the power chip is 16-bit, as shown in the figure below, but only the 8-bit data transmission can be configured in the toolbox. Is there any way to solve it?

pastedImage_2.png

pastedImage_3.png

0 件の賞賛
返信
2,301件の閲覧回数
mariuslucianand
NXP Employee
NXP Employee

Hello lijiantaowy@163.com‌,

I have already sent you a response here https://community.nxp.com/thread/513041 . 

Hope this helps,

Marius

0 件の賞賛
返信
2,301件の閲覧回数
constantinrazva
NXP Employee
NXP Employee

Hello abhishek.kumar@chassisbrakes.com‌,

There seems to be a problem with a define in the makefile. All problems begin here:

MPC5744P.h:17064:61: error: expected ')' before '*' token
#define SPI_0 ((SPI_Type *)SPI_0_BASE)

I will take a look and come back with a fix.

Kind regards,

Razvan.