Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/commands/GoCommand.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ void KeyboardBreak(void) {
FD_SET(serialport, &readfds);
if (serialport > maxport) maxport = serialport;
}
timeout = (struct timeval){10,0}; // 10 seconds
timeout = (struct timeval){0,200000ul}; // 0.2 seconds
if (select(maxport+1, &readfds, 0, &excpfds, &timeout) > 0) {
// Something became available
if ((CurrentPortKind() == 's') && FD_ISSET(serialport, &readfds)) {
Expand Down
8 changes: 4 additions & 4 deletions src/dwire/DigiSpark.c
Original file line number Diff line number Diff line change
Expand Up @@ -187,10 +187,10 @@ void digisparkUSBSendBytes(struct UPort *up, u8 state, char *out, int outlen) {
int tries = 0;
int status = usb_control_msg(up->handle, OUT_TO_LW, 60, state, 0, out, outlen, USB_TIMEOUT);

while ((tries < 200) && (status <= 0)) {
while ((tries < 1000) && (status <= 0)) {
// Wait for previous operation to complete
tries++;
delay(5);
delay(1);
status = usb_control_msg(up->handle, OUT_TO_LW, 60, state, 0, out, outlen, USB_TIMEOUT);
}
if (status < outlen) {Ws("Failed to send bytes to AVR, status "); Wd(status,1); PortFail(up, "");}
Expand Down Expand Up @@ -249,9 +249,9 @@ int DigisparkReceive(struct UPort *up, u8 *in, int inlen) {

digisparkBufferFlush(up, 0x14);

while ((tries < 200) && (status <= 0)) {
while ((tries < 1000) && (status <= 0)) {
tries++;
delay(5);
delay(1);
// Read back dWIRE bytes
status = usb_control_msg(up->handle, IN_FROM_LW, 60, 0, 0, (char*)in, inlen, USB_TIMEOUT);
}
Expand Down
3 changes: 2 additions & 1 deletion src/gdbserver/GdbserverCommand.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ void GdbserverCommand(void)
}

Wsl("Target ready, waiting for GDB connection.");
fprintf(stderr, "%s", "\nInfo : avrchip: hardware has something\n"); //vscode check stderr for start, mimic a openocd process
fprintf(stderr, "%s", "\r\nInfo : avrchip: hardware has something\r\n"); //vscode check stderr for start, mimic a openocd process
fflush(stderr);
Ws("Use 'target remote :"); Wd(LISTEN_PORT,1); Wsl("'");

connfd = listen_sock(LISTEN_PORT);
Expand Down
6 changes: 3 additions & 3 deletions src/gdbserver/rsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -192,15 +192,15 @@ void handle_command(int fd, const char *cmd)
{
switch (cmd[0]) {
case '?':
write_resp(fd, "S00");
write_resp(fd, "S05");
break;
case 'c':
target_continue(fd);
write_resp(fd, "S00");
write_resp(fd, "S05");
break;
case 's':
target_step();
write_resp(fd, "S00");
write_resp(fd, "S05");
break;
case 'g':
cmd_read_registers(fd);
Expand Down
26 changes: 24 additions & 2 deletions usbtiny/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1482,10 +1482,24 @@ void dwReadBytes() {
"; Interrupts already disabled \n"
"; DDRB pin5 is input \n"
" \n"
"; Wait up to 65536*6 cycles = 23.8ms for start bit \n"
"; Wait up to 65536*6 cycles = 23.8ms for start bit on 1st Byte\n"
"; Wait up to 8*dwBitTime*6 cycles for start bit on other Bytes\n"
" \n"
"dwr2: clr r30 \n"
" clr r31 \n"
" tst r23 ; check total bytes received so far \n"
" breq dwr4 ; if we already got data, wait less \n"
" ldi r30,3 ; use r30 temporarily to load number \n"
" mov r0,30 ; set value on r0 \n"
" movw r30,r24 ; load bit time as iteration count \n"
"dwr2_1: lsl r30 ; left shift \n"
" rol r31 ; \n"
" brcc dwr2_2 ; branch if there is no overflow \n"
" clr r30 \n"
" clr r31 \n"
" rjmp dwr4 ; using max value when overflow \n"
"dwr2_2: dec r0 ; \n"
" brne dwr2_1 ; left shift more bits \n"
" \n"
"dwr4: sbiw r30,1 ; 2. Check for timeout \n"
" breq dwr14 ; 1/2. If no start bit encountered \n"
Expand Down Expand Up @@ -1916,7 +1930,15 @@ int main(void) {
// bit flag, and is arranged so that sending a 33 (send break and read pulse widths)
// will abort a pending wait.

if (dwState & 0x34) {_delay_ms(2);} // Allow USB transfer to complete before
if (dwState & 0x34) {
uchar usbInterruptCountPrev, usbInterruptCountNow;
usbInterruptCountNow = usbInterruptCount; //usbInterruptCount got increased in every USB interrupt
do {
usbInterruptCountPrev=usbInterruptCountNow;
_delay_us(200);
usbInterruptCountNow = usbInterruptCount;
} while( usbInterruptCountPrev!= usbInterruptCountNow);
} // Allow USB transfer to complete before
// any action that may disable interrupts

if (dwState & 0x01) {cbi(PORTB, 5); sbi(DDRB, 5); _delay_ms(100);}
Expand Down
Loading