swd_ make rising clock edge sharper
This commit is contained in:
parent
f9b7be3599
commit
a0fdce3318
|
@ -177,8 +177,8 @@ bool swd_set_pins(uint32_t swclk_port, uint32_t swclk_pin, uint32_t swdio_port,
|
|||
rcc_periph_clock_enable(swd_swclk_rcc); // enable clock for GPIO peripheral for clock signal
|
||||
gpio_set(swd_swclk_port, swd_swclk_pin); // inactive clock is high
|
||||
gpio_mode_setup(swd_swclk_port, GPIO_MODE_OUTPUT, GPIO_PUPD_NONE, swd_swclk_pin); // the host controls the clock
|
||||
//gpio_set_output_options(swd_swclk_port, GPIO_OTYPE_PP, GPIO_OSPEED_25MHZ, swd_swclk_pin); // set SWCLK pin output as push-pull
|
||||
gpio_set_output_options(swd_swclk_port, GPIO_OTYPE_OD, GPIO_OSPEED_25MHZ, swd_swclk_pin); // set SWCLK pin output as open-drain (with external pull-up)
|
||||
//gpio_set_output_options(swd_swclk_port, GPIO_OTYPE_PP, GPIO_OSPEED_50MHZ, swd_swclk_pin); // set SWCLK pin output as push-pull
|
||||
gpio_set_output_options(swd_swclk_port, GPIO_OTYPE_OD, GPIO_OSPEED_50MHZ, swd_swclk_pin); // set SWCLK pin output as open-drain (with external pull-up)
|
||||
rcc_periph_clock_enable(swd_swdio_rcc); // enable clock for GPIO peripheral for data signal
|
||||
gpio_set(swd_swdio_port, swd_swdio_pin); // inactive data is high (resetting the target when clock is active)
|
||||
gpio_mode_setup(swd_swdio_port, GPIO_MODE_OUTPUT, GPIO_PUPD_NONE, swd_swdio_pin); // the data signal is half duplex, with the host controlling who is driving the data signal when
|
||||
|
@ -462,9 +462,9 @@ void TIM_ISR(SWD_TIMER)(void)
|
|||
swd_bits_out &= ~(1ULL << swd_bits_i); // clear bit
|
||||
}
|
||||
swd_bits_i++;
|
||||
gpio_set_output_options(swd_swclk_port, GPIO_OTYPE_PP, GPIO_OSPEED_25MHZ, swd_swclk_pin); // we need an extremely sharp rising edge
|
||||
gpio_set_output_options(swd_swclk_port, GPIO_OTYPE_PP, GPIO_OSPEED_50MHZ, swd_swclk_pin); // we need an extremely sharp rising edge
|
||||
gpio_set(swd_swclk_port, swd_swclk_pin); // output rising clock edge
|
||||
gpio_set_output_options(swd_swclk_port, GPIO_OTYPE_OD, GPIO_OSPEED_25MHZ, swd_swclk_pin); // go back to open-drain once we are high
|
||||
gpio_set_output_options(swd_swclk_port, GPIO_OTYPE_OD, GPIO_OSPEED_50MHZ, swd_swclk_pin); // go back to open-drain once we are high
|
||||
}
|
||||
edge_falling = !edge_falling; // remember opposite upcoming edge
|
||||
} else { // no other interrupt should occur
|
||||
|
|
Loading…
Reference in New Issue