Skip to content

Commit ddca3e7

Browse files
committed
Some updates
1 parent 38418f9 commit ddca3e7

File tree

6 files changed

+14
-17
lines changed

6 files changed

+14
-17
lines changed

picoISP_Programmer/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ The CH552E is a low-cost, enhanced E8051 core microcontroller compatible with th
1919
The picoisp firmware is an enhanced port of the USBtinyISP firmware originally developed by Dick Streefland and Ladyada for ATtiny microcontrollers. This port is based on the conversion for CH55x microcontroller by DeqingSun. It includes the [auto-clock extension](https://github.com/nerdralph/usbasp) by Ralph Doncaster, which automatically selects the maximum programming speed, and a [Windows Compatible ID](https://github.com/pbatard/libwdi/wiki/WCID-Devices) (WCID) for automated driver installation on Windows. Since it is compatible with the original USBtinyISP, it works fine with AVRdude (avrdude -c usbtiny) and the Arduino IDE (Tools -> Programmer -> USBtinyISP).
2020

2121
### picoasp for USBasp Compatibility
22-
The picoasp firmware is an enhanced port of the USBasp firmware originally developed by Thomas Fischl for ATmega8 microcontrollers. It includes the auto-clock extension by Ralph Doncaster, which automatically selects the maximum programming speed, and a Windows Compatible ID (WCID) for automated driver installation on Windows. Since it is compatible with the original USBasp, it works fine with AVRdude (avrdude -c usbasp) and the Arduino IDE (Tools -> Programmer -> USBasp).
22+
The picoasp firmware is an enhanced port of the USBasp firmware originally developed by Thomas Fischl for ATmega8 microcontrollers. It includes the auto-clock extension by Ralph Doncaster, which automatically selects the maximum programming speed, and a Windows Compatible ID (WCID) for automated driver installation on Windows. It also supports the TPI protocol, enabling the programming of devices such as the ATtiny10. Since it is compatible with the original USBasp, it works fine with AVRdude (avrdude -c usbasp) and the Arduino IDE (Tools -> Programmer -> USBasp).
2323

2424
### picostk for STK500 Compatibility
2525
The picostk firmware is an improved port of the ArduinoISP (or Arduino as ISP) firmware originally developed by Randall Bohn for the Arduino Uno. It is compatible with the STK500v1 programmer. In addition, Ralph Doncaster's auto-clock extension is included, which automatically selects the maximum programming speed. It works fine with AVRdude (avrdude -c stk500v1 or avrdude -c arduino) and the Arduino IDE (Tools -> Programmer -> Arduino as ISP). Don't forget to choose the right serial port.
-28 Bytes
Binary file not shown.

picoISP_Programmer/software/picoasp/picoasp.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
11
// ===================================================================================
22
// Project: picoASP AVR ISP Programmer based on CH551, CH552, CH554
3-
// Version: v0.4
3+
// Version: v1.0
44
// Year: 2023
55
// Author: Stefan Wagner
66
// Github: https://github.com/wagiminator
77
// EasyEDA: https://easyeda.com/wagiminator
88
// License: http://creativecommons.org/licenses/by-sa/3.0/
99
// ===================================================================================
1010
//
11-
// !!! This firmware version is experimental and still in development !!!
12-
// ToDo: make TPI work
13-
//
1411
// Description:
1512
// ------------
1613
// The CH55x-based picoASP is an ISP/TPI programmer for AVR microcontrollers compatible

picoISP_Programmer/software/picoasp/src/tpi.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
// ===================================================================================
2-
// TPI Functions for for CH551, CH552 and CH554
2+
// TPI Functions for for CH551, CH552 and CH554 * v1.1 *
33
// ===================================================================================
44

55
#include "tpi.h"
66

7-
__xdata uint16_t TPI_dly_cnt;
7+
__xdata uint8_t TPI_dly_cnt;
88

99
// Transmit/receive one bit via TPI; b must be 1 when receiving
1010
__bit TPI_clockBit(__bit b) {
1111
__bit result;
12-
uint16_t cnt;
12+
uint8_t cnt;
1313
PIN_write(PIN_MOSI, b); // set DATA according to bit
1414
cnt = TPI_dly_cnt; while(cnt--); // delay
1515
PIN_high(PIN_SCK); // CLK high
16-
result = PIN_read(PIN_MOSI); // read DATA
1716
cnt = TPI_dly_cnt; while(cnt--); // delay
17+
result = PIN_read(PIN_MOSI); // read DATA
1818
PIN_low(PIN_SCK); // CLK low
1919
return result;
2020
}
@@ -29,28 +29,28 @@ void TPI_connect(void) {
2929

3030
PIN_high(PIN_RESET); // RST high
3131
PIN_output(PIN_RESET); // RST to output
32-
DLY_us(1000); // wait a bit (128ms ???)
32+
DLY_us(1000); // wait a bit
3333
PIN_low(PIN_RESET); // RST low
34+
DLY_us(5600); // wait a bit
3435
PIN_high(PIN_MOSI); // DATA high
3536
PIN_input_PU(PIN_MOSI); // DATA input pullup, open-drain output
36-
DLY_us(5600); // wait a bit (2000ns ???)
3737
PIN_low(PIN_SCK); // CLK low
3838
PIN_output(PIN_SCK); // CLK to output
3939

40-
for(i=32; i; i--) TPI_clockBit(1); // DATA high for 32 TPI clock cycles (16 ???)
40+
for(i=32; i; i--) TPI_clockBit(1); // DATA high for 32 TPI clock cycles
4141
}
4242

4343
// Disconnect TPI bus
4444
void TPI_disconnect(void) {
4545
TPI_writeByte(TPI_OP_SSTCS(TPISR));
4646
TPI_writeByte(0);
4747
DLY_us(3200);
48-
PIN_input(PIN_SCK); // CLK to input, high-impedance
49-
PIN_input(PIN_MOSI); // DATA to input, high-impedance
5048
PIN_high(PIN_RESET); // RST high
5149
DLY_us(1600); // wait a bit
5250
PIN_low(PIN_RESET); // RST low
5351
DLY_us(1600); // wait a bit
52+
PIN_input(PIN_SCK); // CLK to input, high-impedance
53+
PIN_input(PIN_MOSI); // DATA to input, high-impedance
5454
PIN_input(PIN_RESET); // RST to input
5555

5656
#ifdef PIN_LED_PRG
@@ -97,7 +97,7 @@ uint8_t TPI_readByte(void) {
9797
// Read data bits
9898
for(i=8; i; i--) { // 8 bits
9999
result >>= 1; // LSB first
100-
if(TPI_clockBit(1)) result &= 0x80; // get data bit
100+
if(TPI_clockBit(1)) result |= 0x80; // get data bit
101101
}
102102

103103
// Receive and check parity

picoISP_Programmer/software/picoasp/src/tpi.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
#define NVMCMD_WORD_WRITE 0x1D
5656

5757
// Globals
58-
extern __xdata uint16_t TPI_dly_cnt; // number of iterations in tpi_delay loop
58+
extern __xdata uint8_t TPI_dly_cnt; // number of iterations in tpi_delay loop
5959

6060
// Functions
6161
void TPI_connect(void); // connect TPI bus

picoISP_Programmer/software/picoasp/src/usb_asp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ uint8_t ASP_control(void) {
9090
return 1;
9191

9292
case USBASP_FUNC_TPI_CONNECT:
93-
TPI_dly_cnt = *(uint16_t*) &EP0_buffer[2];
93+
TPI_dly_cnt = EP0_buffer[2]; //*(uint16_t*) &EP0_buffer[2];
9494
TPI_connect();
9595
return 0;
9696

0 commit comments

Comments
 (0)