硬汉嵌入式论坛

 找回密码
 立即注册
查看: 2432|回复: 9
收起左侧

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

[复制链接]

8

主题

26

回帖

243

积分

高级会员

积分
243
发表于 2018-5-21 16:40:12 | 显示全部楼层 |阅读模式
RT1050的手册里有关GPIO的功能,里面的DR_SET寄存器好像无法使用,是手册里写错了吗,官方库里也没有看到DR_SET寄存器,是不是这个这个芯片不支持操作? `TG17VG)2_M%{1XGX5CKD.png

回复

使用道具 举报

7

主题

102

回帖

123

积分

初级会员

积分
123
发表于 2018-5-21 16:52:00 | 显示全部楼层
官方库是有的,不过实际能不能我没试过。
  1. typedef struct {
  2.   __IO uint32_t DR;                                /**< GPIO data register, offset: 0x0 */
  3.   __IO uint32_t GDIR;                              /**< GPIO direction register, offset: 0x4 */
  4.   __I  uint32_t PSR;                               /**< GPIO pad status register, offset: 0x8 */
  5.   __IO uint32_t ICR1;                              /**< GPIO interrupt configuration register1, offset: 0xC */
  6.   __IO uint32_t ICR2;                              /**< GPIO interrupt configuration register2, offset: 0x10 */
  7.   __IO uint32_t IMR;                               /**< GPIO interrupt mask register, offset: 0x14 */
  8.   __IO uint32_t ISR;                               /**< GPIO interrupt status register, offset: 0x18 */
  9.   __IO uint32_t EDGE_SEL;                          /**< GPIO edge select register, offset: 0x1C */
  10.        uint8_t RESERVED_0[100];
  11.   __O  uint32_t DR_SET;                            /**< GPIO data register SET, offset: 0x84 */
  12.   __O  uint32_t DR_CLEAR;                          /**< GPIO data register CLEAR, offset: 0x88 */
  13.   __O  uint32_t DR_TOGGLE;                         /**< GPIO data register TOGGLE, offset: 0x8C */
  14. } GPIO_Type;
复制代码
  1. /*!
  2. * @brief Sets the output level of the multiple GPIO pins to the logic 1.
  3. *
  4. * @param base GPIO peripheral base pointer (GPIO1, GPIO2, GPIO3, and so on.)
  5. * @param mask GPIO pin number macro
  6. */
  7. static inline void GPIO_PortSet(GPIO_Type *base, uint32_t mask)
  8. {
  9.     base->DR_SET = mask;
  10. }

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

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

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

  37. /*!
  38. * @brief Reverses the current output logic of the multiple GPIO pins.
  39. *
  40. * @param base GPIO peripheral base pointer (GPIO1, GPIO2, GPIO3, and so on.)
  41. * @param mask GPIO pin number macro
  42. */
  43. static inline void GPIO_PortToggle(GPIO_Type *base, uint32_t mask)
  44. {
  45.     base->DR_TOGGLE = mask;
  46. }
复制代码
回复

使用道具 举报

8

主题

26

回帖

243

积分

高级会员

积分
243
 楼主| 发表于 2018-5-21 17:06:28 | 显示全部楼层
我使用的估计是旧版的库,里面没有DR_SET,不过我直接寄存器操作,在线调试寄存器写成功了,但是管脚输出没变化,是不是RT1050最开始的评估板用的芯片不支持该功能,后来有升级了芯片?
回复

使用道具 举报

7

主题

102

回帖

123

积分

初级会员

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

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

使用道具 举报

8

主题

26

回帖

243

积分

高级会员

积分
243
 楼主| 发表于 2018-5-21 17:21:02 | 显示全部楼层
哥们,NXP的注册密码忘了,不是会员看不到,传一份这个文档,我也看看,i.MXRT1050 Migration Guide,谢了
回复

使用道具 举报

5

主题

196

回帖

211

积分

高级会员

积分
211
发表于 2018-5-21 17:40:46 | 显示全部楼层
A0不支持,库里添加了一些A1才支持的IO操作(比如toggle),具体看Errata勘误文档
回复

使用道具 举报

7

主题

102

回帖

123

积分

初级会员

积分
123
发表于 2018-5-21 17:41:43 | 显示全部楼层
没有啊,这个文档没有上锁的啊,我都没登陆账户。

AN12146.pdf

166.33 KB, 下载次数: 50

i.MXRT1050 Migration Guide

回复

使用道具 举报

8

主题

26

回帖

243

积分

高级会员

积分
243
 楼主| 发表于 2018-5-21 17:45:08 | 显示全部楼层
谢谢,我尽然打不开这个文档
回复

使用道具 举报

8

主题

26

回帖

243

积分

高级会员

积分
243
 楼主| 发表于 2018-5-21 17:56:19 | 显示全部楼层
买的是旧开发板,没有这个功能,设计的时候要用新片才行
QQ图片20180521175429.png
回复

使用道具 举报

1万

主题

6万

回帖

10万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
107128
QQ
发表于 2018-5-22 01:46:57 | 显示全部楼层
这错误有点太低级了
非常感谢大家指出。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|小黑屋|Archiver|手机版|硬汉嵌入式论坛

GMT+8, 2024-5-19 22:09 , Processed in 0.312783 second(s), 28 queries .

Powered by Discuz! X3.4 Licensed

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表