Skip to content

Commit 7a8c9eb

Browse files
committed
Fix issue #5
1 parent 3228ccc commit 7a8c9eb

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed
27 Bytes
Binary file not shown.

picoISP_Programmer/software/picostk/picostk.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// ===================================================================================
22
// Project: picoSTK AVR ISP Programmer based on CH551, CH552, CH554
3-
// Version: v1.2
3+
// Version: v1.3
44
// Year: 2023
55
// Author: Stefan Wagner
66
// Github: https://github.com/wagiminator

picoISP_Programmer/software/picostk/src/isp.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -260,9 +260,11 @@ uint8_t write_flash(uint16_t length) {
260260
}
261261

262262
uint8_t write_eeprom(uint16_t length) {
263-
uint16_t x;
264-
for(x = 0; x < length; x++) {
265-
spi_transaction(0xC0, 0x00, (_addr << 1) + x, buff[x]);
263+
uint16_t x = 0;
264+
_addr <<= 1;
265+
while(x < length) {
266+
spi_transaction(0xC0, _addr >> 8, _addr, buff[x++]);
267+
_addr++;
266268
DLY_us(9600);
267269
}
268270
return STK_OK;
@@ -310,9 +312,10 @@ uint8_t flash_read_page(uint16_t length) {
310312
}
311313

312314
uint8_t eeprom_read_page(uint16_t length) {
313-
uint16_t x;
314-
for(x = 0; x < length; x++) {
315-
CDC_write(spi_transaction(0xA0, 0x00, (_addr << 1) + x, 0xFF));
315+
_addr <<= 1;
316+
while(length--) {
317+
CDC_write(spi_transaction(0xA0, _addr >> 8, _addr, 0xFF));
318+
_addr++;
316319
}
317320
return STK_OK;
318321
}

0 commit comments

Comments
 (0)