Skip to content

Commit 29892b4

Browse files
committed
fix: SRST的电平修改
1 parent dfcc525 commit 29892b4

File tree

5 files changed

+32
-5
lines changed

5 files changed

+32
-5
lines changed

projects/HSLink-Pro/src/DAP_config.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ This information includes:
5353
#include <WS2812.h>
5454
#endif
5555

56+
#include "setting.h"
57+
5658
#ifndef __STATIC_INLINE
5759
#define __STATIC_INLINE static inline
5860
#endif
@@ -612,11 +614,12 @@ __STATIC_FORCEINLINE uint32_t PIN_nRESET_IN (void) {
612614
- 1: release device hardware reset.
613615
*/
614616
__STATIC_FORCEINLINE void PIN_nRESET_OUT (uint32_t bit) {
617+
printf("PIN_nRESET_OUT bit = %d, level = %d\n", bit, Setting_GetSRSTLevel());
615618
if(bit & 0x01) {
616-
gpio_write_pin(PIN_GPIO, GPIO_GET_PORT_INDEX(PIN_SRST), GPIO_GET_PIN_INDEX(PIN_SRST), true);
619+
gpio_write_pin(PIN_GPIO, GPIO_GET_PORT_INDEX(PIN_SRST), GPIO_GET_PIN_INDEX(PIN_SRST), Setting_GetSRSTLevel());
617620
}
618621
else {
619-
gpio_write_pin(PIN_GPIO, GPIO_GET_PORT_INDEX(PIN_SRST), GPIO_GET_PIN_INDEX(PIN_SRST), false);
622+
gpio_write_pin(PIN_GPIO, GPIO_GET_PORT_INDEX(PIN_SRST), GPIO_GET_PIN_INDEX(PIN_SRST), !Setting_GetSRSTLevel());
620623
extern uint8_t software_reset(void);
621624
uint8_t ret = software_reset();
622625
(void)ret;

projects/HSLink-Pro/src/JTAG_DP/JTAG_DP_SPI.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ void SPI_PORT_JTAG_SETUP(void)
9393
gpiom_configure_pin_control_setting(PIN_JTAG_TRST);
9494

9595
gpio_set_pin_output(PIN_GPIO, GPIO_GET_PORT_INDEX(PIN_SRST), GPIO_GET_PIN_INDEX(PIN_SRST));
96-
gpio_write_pin(PIN_GPIO, GPIO_GET_PORT_INDEX(PIN_SRST), GPIO_GET_PIN_INDEX(PIN_SRST), 1);
96+
gpio_write_pin(PIN_GPIO, GPIO_GET_PORT_INDEX(PIN_SRST), GPIO_GET_PIN_INDEX(PIN_SRST), Setting_GetSRSTLevel());
9797
gpio_set_pin_output(PIN_GPIO, GPIO_GET_PORT_INDEX(PIN_JTAG_TRST), GPIO_GET_PIN_INDEX(PIN_JTAG_TRST));
9898
gpio_write_pin(PIN_GPIO, GPIO_GET_PORT_INDEX(PIN_JTAG_TRST), GPIO_GET_PIN_INDEX(PIN_JTAG_TRST), 1);
9999

projects/HSLink-Pro/src/SW_DP/SW_DP_SPI.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ void SPI_PORT_SWD_SETUP(void)
4444
HPM_IOC->PAD[PIN_SRST].PAD_CTL = IOC_PAD_PAD_CTL_PRS_SET(2) | IOC_PAD_PAD_CTL_PE_SET(1) | IOC_PAD_PAD_CTL_PS_SET(1) | IOC_PAD_PAD_CTL_SPD_SET(3);
4545
gpiom_configure_pin_control_setting(PIN_SRST);
4646
gpio_set_pin_output(PIN_GPIO, GPIO_GET_PORT_INDEX(PIN_SRST), GPIO_GET_PIN_INDEX(PIN_SRST));
47-
gpio_write_pin(PIN_GPIO, GPIO_GET_PORT_INDEX(PIN_SRST), GPIO_GET_PIN_INDEX(PIN_SRST), 1);
47+
gpio_write_pin(PIN_GPIO, GPIO_GET_PORT_INDEX(PIN_SRST), GPIO_GET_PIN_INDEX(PIN_SRST), Setting_GetSRSTLevel());
4848

4949
gpio_write_pin(PIN_SWDIO_DIR_GPIO, GPIO_GET_PORT_INDEX(SWDIO_DIR), GPIO_GET_PIN_INDEX(SWDIO_DIR), 0); // 默认SWDIO为输入
5050

projects/HSLink-Pro/src/setting.c

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,3 +116,27 @@ void Setting_Save(void)
116116
print_param();
117117
enable_global_irq(CSR_MSTATUS_MIE_MASK);
118118
}
119+
120+
uint8_t Setting_IsHardwareVersion(uint8_t major, uint8_t minor, uint8_t patch)
121+
{
122+
if (major == UINT8_MAX) {
123+
return 1;
124+
} else if (minor == UINT8_MAX) {
125+
return HSLink_Hardware_Version.major == major;
126+
} else if (patch == UINT8_MAX) {
127+
return HSLink_Hardware_Version.major == major && HSLink_Hardware_Version.minor == minor;
128+
} else {
129+
return HSLink_Hardware_Version.major == major && HSLink_Hardware_Version.minor == minor &&
130+
HSLink_Hardware_Version.patch == patch;
131+
}
132+
}
133+
134+
uint8_t Setting_GetSRSTLevel(void)
135+
{
136+
uint8_t level = 1;
137+
if (Setting_IsHardwareVersion(1,2,UINT8_MAX))
138+
{
139+
level = 0;
140+
}
141+
return level;
142+
}

projects/HSLink-Pro/src/usb_config.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#define usb_free(ptr) free(ptr)
2020

2121
#ifndef CONFIG_USB_DBG_LEVEL
22-
#define CONFIG_USB_DBG_LEVEL USB_DBG_LOG
22+
#define CONFIG_USB_DBG_LEVEL USB_DBG_ERROR
2323
#endif
2424

2525

0 commit comments

Comments
 (0)