复位方式有软件复位和硬件复位两种方式。

1.软件复位:对0x36::31-28位进行操作,流程如下

(a) Set SYSCLKS to 01
(b) Clear SOFTRESET to all zero’s
(c) Set SOFTRESET to all ones

note:软件复位并不对深度睡眠或睡眠模式的配置进行操作,如果想对其也进行复位,需手动配置AON寄存器。

可使用模块官方提供的函数void dwt_softreset(void)复位


2.硬件复位:硬件复位需对RSTn引脚进行配置

 dw1000(3)-dw1000模块复位


上图是模块上电后RSTn引脚的输出变化,要注意的是,如果不想对模块进行复位,只需将与之相连的单片机引脚配置成开漏模式(An external source should open-drain the RSTn pin once the DW1000 has been reset.),所以,要复位它,只需将该引脚先拉低,在配置成开漏输出模式。

note:RSTn should never be driven high by an external source

void reset_DW1000(void)
{
GPIO_InitTypeDef GPIO_InitStructure;


// Enable GPIO used for DW1000 reset
GPIO_InitStructure.GPIO_Pin = DW1000_RSTn;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(DW1000_RSTn_GPIO, &GPIO_InitStructure);


//drive the RSTn pin low
GPIO_ResetBits(DW1000_RSTn_GPIO, DW1000_RSTn);


//put the pin back to tri-state ... as input
GPIO_InitStructure.GPIO_Pin = DW1000_RSTn;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AIN;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(DW1000_RSTn_GPIO, &GPIO_InitStructure);


    sleep_ms(2);
}


       


相关文章:

  • 2021-05-19
  • 2022-12-23
  • 2022-12-23
  • 2021-05-19
  • 2022-12-23
  • 2021-11-15
  • 2021-04-25
  • 2021-07-11
猜你喜欢
  • 2021-05-28
  • 2021-10-09
  • 2021-11-17
  • 2021-11-30
  • 2021-08-17
  • 2021-07-13
  • 2021-04-26
相关资源
相似解决方案