Author Topic: Unable to upload sketch after Soft Reset  (Read 2046 times)

Oomek

  • Newbie
  • *
  • Posts: 5
Unable to upload sketch after Soft Reset
« on: November 01, 2016, 08:45:23 am »
When I'm trying to upload sketch after calling the function from wiki it fails.

Code: [Select]
void reboot(void) {
  noInterrupts(); // disable interrupts which could mess with changing prescaler
  CLKPR = 0b10000000; // enable prescaler speed change
  CLKPR = 0; // set prescaler to default (16mhz) mode required by bootloader
  void (*ptrToFunction)(); // allocate a function pointer
  ptrToFunction = 0x0000; // set function pointer to bootloader reset vector
  (*ptrToFunction)(); // jump to reset, which bounces in to bootloader
}

What can I do to fix it?

Here is the log:
Code: [Select]
Running Digispark Uploader...
Plug in device now... (will timeout in 60 seconds)
> Please plug in the device ...
> Press CTRL+C to terminate the program.
> Device is found!
connecting: 16% complete
connecting: 22% complete
connecting: 28% complete
connecting: 33% complete
> Device has firmware version 1.11
> Available space for user applications: 6330 bytes
> Suggested sleep time between sending pages: 8ms
> Whole page count: 99  page size: 64
> Erase function sleep duration: 792ms
parsing: 50% complete
> Erasing the memory ...
erasing: 55% complete
erasing: 60% complete
erasing: 65% complete
> Starting to upload ...
writing: 70% complete
writing: 75% complete
writing: 80% complete
> Starting the user app ...
>> Run error -1 has occured ...
>> Please unplug the device and restart the program.

I've tried also a simpler method
Code: [Select]
void(* resetDigispark) (void) = 0;but the result is the same.
« Last Edit: November 01, 2016, 08:52:23 am by Oomek »