Skip to content

Commit e4461f8

Browse files
authored
Merge pull request #27 from ZhiyuanYuanNJ/master
update ch347.c and openocd.exe
2 parents 1e8dccf + 50a3410 commit e4461f8

File tree

4 files changed

+7
-6
lines changed

4 files changed

+7
-6
lines changed
456 KB
Binary file not shown.

CH347FPGATool/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
![image-20221027190604695](README.assets/image-20221027190604695.png)
88

9-
# **软件使用说明**
9+
# **软件使用**
1010

1111
## **界面显示**
1212

OpenOCD_CH347/bin/openocd.exe

456 KB
Binary file not shown.

OpenOCD_SourceCode_CH347/src/jtag/drivers/ch347.c

+6-5
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
* *
2121
* _____________ *
2222
* | |____JTAG/SWD (TDO,TDI,TMS,TCK,TRST) *
23-
* USB__| CH347T | *
23+
* USB__| CH347T/F | *
2424
* |_____________|____UART(TXD1,RXD1,RTS1,CTS1,DTR1) *
2525
* ______|______ *
2626
* | | *
@@ -234,8 +234,8 @@ bool ugOpen;
234234
unsigned long ugIndex;
235235
struct libusb_device_handle *ch347_handle;
236236

237-
static const uint16_t ch347_vids[] = {0x1a86, 0};
238-
static const uint16_t ch347_pids[] = {0x55dd, 0};
237+
static const uint16_t ch347_vids[] = {0x1a86, 0x1a86};
238+
static const uint16_t ch347_pids[] = {0x55dd, 0x55de};
239239

240240
static uint32_t CH347OpenDevice(uint64_t iIndex)
241241
{
@@ -933,7 +933,7 @@ static void CH347_WriteRead(struct scan_command *cmd, uint8_t *bits,
933933
bit_count += cmd->fields[i].num_bits;
934934
if (ch347.pack_size == LARGER_PACK) {
935935
if (num_bits > 7)
936-
ch347.read_idx += DIV_ROUND_UP(bit_count, 8);
936+
ch347.read_idx += DIV_ROUND_UP(bit_count, 8);
937937
offset += num_bits;
938938
}
939939
}
@@ -1102,11 +1102,12 @@ static int ch347_init(void)
11021102
}
11031103
}
11041104
DevIsOpened = CH347OpenDevice(ugIndex);
1105+
if (DevIsOpened == -1) {
11051106
#elif defined(__linux__)
11061107
DevIsOpened = CH347OpenDevice(ugIndex);
11071108
ugIndex = DevIsOpened;
1109+
if (DevIsOpened == false) {
11081110
#endif
1109-
if (DevIsOpened == -1) {
11101111
LOG_ERROR("CH347 Open Error.");
11111112
return ERROR_FAIL;
11121113
} else {

0 commit comments

Comments
 (0)