I2C and programming failed

Go To Last Post
8 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,

 

I am unable to program my ATtiny24A with my AVRISPII. I get this error message:

"Failed to enter programming mode. Error received from tool:
Connection failed on the data line (MOSI)"

 

I am wondering if this is caused by the accelerometer connected to my ATtiny24A. Can the accelerometer disturb the programming process? I use a STM accelerometer called LIS2DH12. The wiring is like this:

ACC       ATtiny

SCL <-> SCL/USCK (PA4)

SDA <-> SDA/MOSI (PA6)

 

Since it is not so easy to solder this tiny accelerometer, I want to check with you before de-soldering it.

Please advise!

 

 

This topic has a solution.
Last Edited: Fri. Aug 18, 2017 - 08:39 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It is pretty unlikely that the ISP signals wake up the I2C accelerometer.    Even less likely that the accelerometer stretches the bus.

Even if it does,   I would expect your external ISP programmer to "win".

 

I suggest that you toggle power to the board.  And try ISP with a 250kHz SCK frequency.

 

Have you altered the CLKPR register to a silly value?

 

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

In the application hints section of the LIS2DH12 datasheet, it says that CS (on the LIS) has to be tied high for I2C to be enabled.  If it isn't, then either add a 1K pull-up resistor or just wire it to Vcc.   If CS is not tied high, then SPI is enabled when the LIS is powered up.  The activated SPI interface may be pulling the MOSI line high even  when the AVR is in reset/programming mode.  SPI pins are pulled high or low by the SPI logic, they are not 'asserted' and 'released' in the manner that I2C pins are.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The CS on the LIS accelerometer is tied to VCC (3.3V).

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have tried several low frequencies on the ISP; 125kHz, 51kHz, 250kHz without luck. I haven't changed anything on the CLKPR. The last thing I managed to do was to erase the ATtiny's flash. After that I haven't been able to program it.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

larsi wrote:
The last thing I managed to do was to erase the ATtiny's flash. After that I haven't been able to program it.

Looks like you set the wrong fusebit?
.
MG

I don't know why I'm still doing this hobby

This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I couldn't solve this issue, so I changed the AVR on my PCB. When replacing the AVR with a new one I managed to program it.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

larsi wrote:

I couldn't solve this issue, so I changed the AVR on my PCB. When replacing the AVR with a new one I managed to program it.


You did set the wrong fusebit.
.
MG

I don't know why I'm still doing this hobby