NXP

MPC5744——系统集成单元(SIUL2)

2019-07-12 12:10发布

系统集成单元最主要的作用是控制引脚的功能和电气特性。同时还能控制内部信号路由到另外一个,模块之中。
寄存器汇总:
SIUL2_MIDR2
MCU ID 寄存器 #1 和#2 :寄存器内包含着MCU的一些信息。
SIUL2_DISR0
DMA/Interrupt状态标志寄存器 0 共32位,0 没有事件发生,1 DMA或中断事件发生,事件由触发类型寄存器和滤波设置寄存器共同决定。
SIUL2_DIRER0
DMA/中断使能寄存器,如果使能了相应的位,在SIUL2_DISR0中该位置一,则产生DMA或中断请求。此寄存器控制着中断是否向内核发送中断消息。0 禁止 1 使能
SIUL2_DIRSR0
DMA/中断选择寄存器,选择是中断请求还是DMA请求,0 中断 1 保留/DMA。
SIUL2_IREER0
上升沿触发使能寄存器。使能相应的引脚上上升沿事件的触发。0 禁止 1 使能。
SIUL2_IFEER0
下降沿触发使能寄存器。使能相应的引脚上下降沿事件的触发。0 禁止 1 使能。
SIUL2_IFER0
中断滤波器使能寄存器。
SIUL2_IFMCRn
中断滤波器最大计数值寄存器。MAXCNT= 0 ~2 没有作用,MAXCNT= 3~15 TCK*MAXCNT+n*TCK n=1 2 3 4。 TCK是是由滤波器时钟分频而来的。
SIUL2_IFCPR
滤波器分频时钟。时钟 = = T(IRC) x (IFCP + 1) T(IRC) :内部振荡器时钟,IFCP = 0~15d
SIUL2_MSCRn
信号的分路配置信号寄存器。决定了引脚上的信号源是哪个。对于MSCR的分配、APC的指出和SSS的值要看引脚描述表。SRC转换速率控制,OBE输出缓冲使能,ODE开漏使能。SMC安全模式控制,APC模拟引脚控制,IBE输入缓存使能,HYS输入延迟,PUS上拉,PUE下拉,INV反转,SSS,选择引脚的备选功能。
这里写图片描述
SIUL2_IMCRn
输入信号分路配置寄存器。决定了引脚上的信号传输给哪个引脚或者模块。INV反转,SSS,选择引脚的备选功能。
这里写图片描述
SIUL2_GPDOn
引脚输出寄存器,以字节的形式写一或清零。PDO_4n PDO_4n1 PDO_4n2 PDO_4n3
SIUL2_GPDIn
引脚数据输入寄存器,PDO_4n PDO_4n1 PDO_4n2 PDO_4n3
SIUL2_PGPDOn
并行GPIO数据输出寄存器,允许配置单独的引脚PPDO[x][y] = PDO[(x*16)+y]
SIUL2_PGPDIn
并行GPIO数据输入寄存器,允许配置单独的引脚PPDI[x][y] = PDI[(x*16)+y]
SIUL2_MPGPDOn
选择性的与PPDO[x]相关的修改引脚值,MPPDO : 0 无视MPPDO[x] ,1 MPPDO[x] 位写入;MPPDO 写一会保存引脚值。 功能描述: SIUL2可以通过PORT或独立位的形式来配置引脚。
普通输入、输出引脚:
每个引脚都可以配置为GPIO,所有的引脚都被以PORT归类,可以以8、16、32位的形式来读写。
这里写图片描述
数据输出寄存器可以读写,数据输入寄存器只能写。
引脚可以被配置为备选功能,一旦被选为了备选功能,读输入寄存器,仍体现了引脚上的输入,但向输出寄存器写入,并不会直接反应待引脚上,知道该引脚再次被配置为GPIO。
外部中断/DMA请求:
SIUL最大支持32个中断请求,根据MCU的不同分配资源不同(见信号描述)。
SIUL支持4和中断向量,每个向量包含8个引脚的中断。分在一组内的外部中断有着相同的优先级。每组的优先级是固定的,但是把那个引脚分在那个组内可以是通过配置改变的。
外部中断的初始化:
- Mask interrupts by clearing the EIREn bits in DIRER0
- Select the pin polarity by setting the appropriate IREEn bits in IREER0 and the appropriate IFEEn bits in IFEER0 as desired
- Configure the appropriate bits in the MSCR[0:511] register for the external interrupt
pin(s) desired as follows:
- Clear the OBE and ODE bits to disable output
- Set the IBE bit to enable the pin’s input buffer
- If using the internal pullup/pulldown, configure the appropriate PUE and PUS
fields
- Select the request desired between DMA or Interrupt by writing the appropriate
DIRSn bits in DIRSR0
- Select the desired glitch filter setup for the pins by writing the following:
- Write the Filter Counter setting to the desired value by writing the MAXCNT[3:0] bits in the IFMCn register for the respective external interrupt that is being used
- Set the Filter Clock Prescaler setting from 0 to 15 to the desired value by writing
the IFCP[3:0] bits in the IFCPR register
- Enable the glitch filter for the desired external interrupt pins by setting the
appropriate IFEn bits in IFER0
- Write to EIFn bits in DISR0 to as desired to clear any flags
- Enable the interrupt pins by setting the appropriate EIREn bits in DIRER0
外部中断管理;
用户可以通过SIUL2_DIRER0寄存器来使能或关闭中断,可以选择上升沿、下降沿或两者同时触发。SIUL2_IREER和SIUL2_IFEER两个寄存器控制IRQ边沿是否激活。
这里写图片描述
外部中断请求:
外部中断请求是外部中断/DMA的请求源。32个中断请求源向量和通道的映射关系如图;
这里写图片描述
DMA请求
DMA的请求引脚直接映射到了DMA控制器的通道上,4个引脚与4个通道意义对应,具体的关系参照:Device Configuration information。 普通IO的设置: SIUL2.MSCR[x].B.SSS = 0; /* 将引脚x的功能设置为GPIO */ SIUL2.MSCR[x].B.OBE = 1; /* 使能输出缓存 */ SIUL2.MSCR[x].B.IBE = 0; /* 禁止输出缓存*/ SIUL2.GPDO[98].B.PDO = 1; /* 输出为高电平 */