目 录CONTENT

文章目录

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

moke
2024-07-10 / 0 评论 / 0 点赞 / 44 阅读 / 0 字

1、CRC概述

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

        CRC图示如下

1.1、CRC配置

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

CRC的选择

这点需要十分注意:硬件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

中断图示如下

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

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

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

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

IntCtrl_Ip_Init(&IntCtrlConfig_0);

PIT中断开启

Pit_Ip_EnableChannelInterrupt(PIT0_INST, PIT0_CH2);

3、Power

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

Power_Ip_MC_ME_SocTriggerResetEvent(POWER_IP_FUNC_RESET_MODE);
博主关闭了所有页面的评论