S32K144 Simple FlexCan Tx not working

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

S32K144 Simple FlexCan Tx not working

ソリューションへジャンプ
1,173件の閲覧回数
ck182
Contributor II

Hi,

i am newbie in S32K1 Platform

I try to get can-bus communication on S32K144 demo board.

I start with FlexCAN_Ip_example_S32K144 in loopback and change to normal operation and map the CAN0 RX TX pin but nothing out of TX pin.

This is the main code:

 
/* Initialize the Osif driver */
    OsIf_Init (NULL_PTR);
    /* Write your code here */
    Clock_Ip_Init(&Clock_Ip_aClockConfig[0]);
 
    /* Configure pins */
    Port_Ci_Port_Ip_Init(NUM_OF_CONFIGURED_PINS0, g_pin_mux_InitConfigArr0);
 
 
    IntCtrl_Ip_EnableIrq(CAN0_ORed_0_15_MB_IRQn);
    IntCtrl_Ip_InstallHandler(CAN0_ORed_0_15_MB_IRQn, CAN0_ORED_0_15_MB_IRQHandler, NULL_PTR);
 
    Flexcan_Ip_DataInfoType tx_info = {
            .msg_id_type = FLEXCAN_MSG_ID_STD,
            .data_length = 8u,
            .is_polling = TRUE,
            .is_remote = FALSE,
.fd_enable = FALSE,
    };
    Flexcan_Ip_MsgBuffType rxData;
 
    FlexCAN_Ip_Init(INST_FLEXCAN_0, &FlexCAN_State0, &FlexCAN_Config0);
 
    FlexCAN_Ip_ExitFreezeMode(INST_FLEXCAN_0);
    FlexCAN_Ip_SetStartMode(INST_FLEXCAN_0);
 
 
 
    Lpspi_Ip_StatusType ret;
    Flexcan_Ip_StatusType FlexCAN_Api_Status;
    /*
     * SPI Init
     */
    ret=Lpspi_Ip_Init(&Lpspi_Ip_PhyUnitConfig_SpiPhyUnit_0_Instance_1_BOARD_InitPeripherals);
 
 
    Spi_TxBuffer[0]=0x40;//sarebbe 0x20 shifttato di un bit
    Spi_TxBuffer[1]=0x2; //sarebbe b010 su attivazione della con
 
    ret=Lpspi_Ip_SyncTransmit(&SPI_IC, Spi_TxBuffer, Spi_RxBuffer,2,5000);
    delay(1000);
 
    while(1){
    FlexCAN_Api_Status = FlexCAN_Ip_Send(INST_FLEXCAN_0, TX_MB_IDX, &tx_info, MSG_ID, (uint8 *)&dummyData);
        // Polling
        while(FlexCAN_Ip_GetTransferStatus(INST_FLEXCAN_0, TX_MB_IDX) != FLEXCAN_STATUS_SUCCESS)
        {
        FlexCAN_Ip_MainFunctionWrite(INST_FLEXCAN_0, TX_MB_IDX);
        }
 
    delay(720000);
    }
 
Also if there are any tutorial/example are usefull
Thank you in advantage,
Patrick
0 件の賞賛
返信
1 解決策
1,158件の閲覧回数
PetrS
NXP TechSupport
NXP TechSupport

Hi,

there can be several reasons why it does not work. Ideally is to measure TXD/RXD/and CAN bus lines with scope/analyzer and read module MCR/CTRL1/ECR/ESR1 registers to see module status and if any error are detected.
If you do not see anything on TXD pin, common issues are
- pin initialization
- CAN transceiver status. On EVB be sure SBC's CAN transceiver is active. Power EVB by external 12V 

BR, Petr

元の投稿で解決策を見る

2 返答(返信)
1,159件の閲覧回数
PetrS
NXP TechSupport
NXP TechSupport

Hi,

there can be several reasons why it does not work. Ideally is to measure TXD/RXD/and CAN bus lines with scope/analyzer and read module MCR/CTRL1/ECR/ESR1 registers to see module status and if any error are detected.
If you do not see anything on TXD pin, common issues are
- pin initialization
- CAN transceiver status. On EVB be sure SBC's CAN transceiver is active. Power EVB by external 12V 

BR, Petr

1,120件の閲覧回数
ck182
Contributor II
Thank you very much for your time. To fix my mistakes:
- Power EVB by external 12V
- .is_polling = FALSE

Thank you,
Patrick
0 件の賞賛
返信