ARTICLE DETAIL

建站实战干货

来自一线的建站与推广经验沉淀,每一条都经过真实交付验证。

NXP实战笔记(九):S32K3xx基于RTD-SDK在S32DS上配置 CRCIRQPower

2026/9/15 13:59:23 拓冰建站 浏览量
NXP实战笔记(九):S32K3xx基于RTD-SDK在S32DS上配置 CRCIRQPower

目录

 

1、CRC概述

1.1、CRC配置

1.2、代码示例

2、INTCTRL

3、Power


 

1、CRC概述

        硬件CRC产生16或者32bit的,S32K3提供了可编程多项式与其他参数需求。

        CRC图示如下

1c4a9438325046ddb5d6a9fb961c6ff6.png

1.1、CRC配置

暂时DMA不怎么会用,所以没有启用DMA

05ad9359a2c4418e8a12cd2843bb908b.png

CRC的选择

d4a57699d63f461a8723f464eab65ab7.png

465cac71cbc34c289129d51941b27209.png

这点需要十分注意:硬件CRC只支持CRC16与CRC32,其他的CRC需要用软件或者查表方式。

硬件CRC:非常快,但是需要MCU支持才行

查表CRC:一般速度,不需要特定的硬件支持

软件CRC:非常慢,但是比较灵活也不需要要硬件支持

1.2、代码示例

初始化

 Crc_Ip_LogicChannelConfigType LogicChannelCfg_32bit_Ethernet = {/* Crc_Ip_ProtocolType Protocol */ CRC_PROTOCOL_32BIT_ETHERNET,/* uint32  PolynomialValue      */ 0U,    /* For non-custom protocol, this value doesn't need initialization *//* boolean WriteBitSwap         */ FALSE, /* For non-custom protocol, this value doesn't need initialization *//* boolean WriteByteSwap        */ FALSE, /* For non-custom protocol, this value doesn't need initialization *//* boolean ReadBitSwap          */ FALSE, /* For non-custom protocol, this value doesn't need initialization *//* boolean ReadByteSwap         */ FALSE, /* For non-custom protocol, this value doesn't need initialization *//* boolean InverseEnable        */ FALSE,  /* For non-custom protocol, this value doesn't need initialization *//* boolean LookUpTable          */ NULL_PTR  /* For non-custom protocol, this value doesn't need initialization */};Crc_Ip_Init(&CrcIp_xConfigInit);    /* Initialize CRC driver */
Crc_Ip_SetChannelConfig(CRC_LOGIC_CHANNEL_0, &LogicChannelCfg_32bit_Ethernet);  /* Config HARDWARE_CALCULATION with CRC_PROTOCOL_32BIT_ETHERNET */

执行代码

 CrcResult = Crc_Ip_SetChannelCalculate(CRC_LOGIC_CHANNEL_0, DataPtr, Length, (uint64)StartValue, IsFirstCall);

2、INTCTRL

中断图示如下

4f448d8972164ff29bb503ebf92ef833.png

中断的配置非常简单,插入中断即可

4cdd836c2f4546a58b6778e8377346f9.png

中断怎么命名的呢?如下图,怎么知道是PIT呢?

cbc528b93c77404aaa71eba5571bf18d.png

中断均在对应的源文件里面

2377d32454394776b818f8a644cb5481.png

        代码实现,中断也是需要初始化的。总的初始化完成之后,需要在各个外设模块里面使能中断操作的。

IntCtrl_Ip_Init(&IntCtrlConfig_0);

PIT中断开启

Pit_Ip_EnableChannelInterrupt(PIT0_INST, PIT0_CH2);

3、Power

bd690970c5b64261b38780f9956f87d5.png

5d24179e1d774c09bc19875050187992.png

0e4c9f48f5064cb98a23fb00d039a9ba.png

022a39b1b2d5444591dbe91bf5c59f3b.png

正常程序执行,需要POWER功能里面的如下函数,执行Boot复位。

Power_Ip_MC_ME_SocTriggerResetEvent(POWER_IP_FUNC_RESET_MODE);