xufeixueren 发表于 2018-5-21 16:40:12

GPIO的设置和清除寄存器实际无法使用?

RT1050的手册里有关GPIO的功能,里面的DR_SET寄存器好像无法使用,是手册里写错了吗,官方库里也没有看到DR_SET寄存器,是不是这个这个芯片不支持操作?

eddy0317 发表于 2018-5-21 16:52:00

官方库是有的,不过实际能不能我没试过。
typedef struct {
__IO uint32_t DR;                              /**< GPIO data register, offset: 0x0 */
__IO uint32_t GDIR;                              /**< GPIO direction register, offset: 0x4 */
__Iuint32_t PSR;                               /**< GPIO pad status register, offset: 0x8 */
__IO uint32_t ICR1;                              /**< GPIO interrupt configuration register1, offset: 0xC */
__IO uint32_t ICR2;                              /**< GPIO interrupt configuration register2, offset: 0x10 */
__IO uint32_t IMR;                               /**< GPIO interrupt mask register, offset: 0x14 */
__IO uint32_t ISR;                               /**< GPIO interrupt status register, offset: 0x18 */
__IO uint32_t EDGE_SEL;                        /**< GPIO edge select register, offset: 0x1C */
       uint8_t RESERVED_0;
__Ouint32_t DR_SET;                            /**< GPIO data register SET, offset: 0x84 */
__Ouint32_t DR_CLEAR;                        /**< GPIO data register CLEAR, offset: 0x88 */
__Ouint32_t DR_TOGGLE;                         /**< GPIO data register TOGGLE, offset: 0x8C */
} GPIO_Type;
/*!
* @brief Sets the output level of the multiple GPIO pins to the logic 1.
*
* @param base GPIO peripheral base pointer (GPIO1, GPIO2, GPIO3, and so on.)
* @param mask GPIO pin number macro
*/
static inline void GPIO_PortSet(GPIO_Type *base, uint32_t mask)
{
    base->DR_SET = mask;
}

/*!
* @brief Sets the output level of the multiple GPIO pins to the logic 1.
* @deprecated Do not use this function.It has been superceded by @ref GPIO_PortSet.
*/
static inline void GPIO_SetPinsOutput(GPIO_Type* base, uint32_t mask)
{
    GPIO_PortSet(base, mask);
}

/*!
* @brief Sets the output level of the multiple GPIO pins to the logic 0.
*
* @param base GPIO peripheral base pointer (GPIO1, GPIO2, GPIO3, and so on.)
* @param mask GPIO pin number macro
*/
static inline void GPIO_PortClear(GPIO_Type *base, uint32_t mask)
{
    base->DR_CLEAR = mask;
}

/*!
* @brief Sets the output level of the multiple GPIO pins to the logic 0.
* @deprecated Do not use this function.It has been superceded by @ref GPIO_PortClear.
*/
static inline void GPIO_ClearPinsOutput(GPIO_Type* base, uint32_t mask)
{
    GPIO_PortClear(base, mask);
}

/*!
* @brief Reverses the current output logic of the multiple GPIO pins.
*
* @param base GPIO peripheral base pointer (GPIO1, GPIO2, GPIO3, and so on.)
* @param mask GPIO pin number macro
*/
static inline void GPIO_PortToggle(GPIO_Type *base, uint32_t mask)
{
    base->DR_TOGGLE = mask;
}

xufeixueren 发表于 2018-5-21 17:06:28

我使用的估计是旧版的库,里面没有DR_SET,不过我直接寄存器操作,在线调试寄存器写成功了,但是管脚输出没变化,是不是RT1050最开始的评估板用的芯片不支持该功能,后来有升级了芯片?

eddy0317 发表于 2018-5-21 17:13:58

xufeixueren 发表于 2018-5-21 17:06
我使用的估计是旧版的库,里面没有DR_SET,不过我直接寄存器操作,在线调试寄存器写成功了,但是管脚输出没 ...

试了一下,的确无效,然后去官网看了一下文档,在i.MXRT1050 Migration Guide (REV 1)里面好像说是A1才有的功能,TMD什么垃圾芯片。

xufeixueren 发表于 2018-5-21 17:21:02

哥们,NXP的注册密码忘了,不是会员看不到,传一份这个文档,我也看看,i.MXRT1050 Migration Guide,谢了

alexyzhov 发表于 2018-5-21 17:40:46

A0不支持,库里添加了一些A1才支持的IO操作(比如toggle),具体看Errata勘误文档

eddy0317 发表于 2018-5-21 17:41:43

没有啊,这个文档没有上锁的啊,我都没登陆账户。

xufeixueren 发表于 2018-5-21 17:45:08

谢谢,我尽然打不开这个文档

xufeixueren 发表于 2018-5-21 17:56:19

买的是旧开发板,没有这个功能,设计的时候要用新片才行

eric2013 发表于 2018-5-22 01:46:57

这错误有点太低级了:L
非常感谢大家指出。
页: [1]
查看完整版本: GPIO的设置和清除寄存器实际无法使用?