Monday 28 November 2011

My quest to program a ATTiny85 with my Arduinon UNO using ISP

While doing the Arduino advanced course at house4hack a while ago, the Ubuntu 11.10 (oneric) guys could not manage to program their ATTiny85 chips although the windows and Ubuntu 10.04 (Lucid) guys managed fine. Today I spent a lot of time trying to get it to work and FINALLY did. Below is the main errors I saw and how to fix it.

Error1:
Binary sketch size: 688 bytes (of a 8192 byte maximum)

avrdude: stk500_getparm(): (a) protocol error, expect=0x14, resp=0x14

avrdude: stk500_getparm(): (a) protocol error, expect=0x14, resp=0x01
avrdude: stk500_initialize(): (a) protocol error, expect=0x14, resp=0x10
avrdude: initialization failed, rc=-1
         Double check connections and try again, or use -F to override
         this check.

avrdude: stk500_disable(): unknown response=0x12

Solution1:
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1286589145
"I think I found one myself.
the problem is that the init request is sent 3 times but only one answer is expected, the following patch should fix":

bilibao@nbarizzi2:~/ELE/arduino-0022$ diff -u examples/ArduinoISP/ArduinoISP.pde /home/bilibao/sketchbook/fixed/fixed.pde
--- examples/ArduinoISP/ArduinoISP.pde  2010-12-24 23:12:25.000000000 +0100
+++ /home/bilibao/sketchbook/fixed/fixed.pde    2011-01-12 01:10:41.373212997 +0100
@@ -54,7 +54,7 @@
  pinMode(9, OUTPUT);
  pulse(9, 2);
}
-
+int initSent=0;
int error=0;
int pmode=0;
// address for reading and writing, set by 'U' command
@@ -399,7 +399,8 @@
  uint8_t ch = getch();
  switch (ch) {
  case '0': // signon
-    empty_reply();
+    if(! initSent) empty_reply();
+    initSent = 1;
    break;
  case '1':
    if (getch() == CRC_EOP) {

I applied the patch above manually and hurray I got a different error!

Error2:
Binary sketch size: 688 bytes (of a 8192 byte maximum)
avrdude: stk500_getsync(): not in sync: resp=0x15
avrdude: please define PAGEL and BS2 signals in the configuration file for part ATtiny85
avrdude: please define PAGEL and BS2 signals in the configuration file for part ATtiny85

avrdude: stk500_paged_write(): (a) protocol error, expect=0x14, resp=0x11
avrdude: stk500_cmd(): programmer is out of sync

Solution2:
Get the following version of the ArduinoISP and apply the patch from solution 1 again.
http://mega-isp.googlecode.com/files/ArduinoISP.04.zip
(found the solution here)

My tiny is now happily blinking away, at last.
I sommer reported this as a bug too, so it may stand a chance of getting fixed.

Saturday 26 November 2011

soldering 101 today

We had a cool soldering course at house4hack today.
Even though I did some soldering before, I'm quite impressed by how much I improved today. (sorry for the fuzzy g1 photos) Before:
After:

Wednesday 16 November 2011

ORA-00001: unique constraint violated

(Pasted here for posterity so probably not an interesting read unless you actually have the same problem and found this while googling) One of my colleagues Leendert Visscher had this weird problem today with a Oracle+JPA+JBOSS getting a
java.sql.BatchUpdateException: ORA-00001: unique constraint violated

Even after making sure all the sequences were fine eg. like checking that quering a nexval and making sure it will not conflict with existing values, the error still persisted :(

The solution was to rebuild the index?!! FTW

We found it after getting the hint while googling a bit.