Electronic – AtmelStudio 6.2 changes the ISP clock when I try to run a program

atmelatmel-studioprogramming

I'm having a strange problem with AtmelStudio. I took a few screenshots:

Here, atmel studio is open and I check the project settings. ISP Clock is set to 125kHz. This is good.

I also check the setting in device programming (Tools -> Device Programming). 250kHz is fine. Reading out the signature is no problem and I can even program the device here under Production File.

So all looks good, I hit F5 to compile and run the program, and this happens. Ouch, unexpected device signature 0x00000000.

At this stage I'm confused. Communication with the device worked perfectly just before. Going into Tools -> Device Programming reveals what happened. The ISP clock is set to 1MHz! Too high for the chip. Obviously reading the signature here fails.

What exactly is happening? Why is AtmelStudio changing the ISP Clock of the programmer? Or where is the 1MHz coming from, is there some config I've overlooked?

Best Answer

I think I figured out the solution.

In the .proj file, ATMEL stores the setting as ISPClock, but they don't read it back as IspClock. They try to read it back as DebugWireClockDiv, but that never exists.

So just open the .cppproj file and search for the following, and add the element to match your IspClock.

<com_atmel_avrdbg_tool_atmelice>
  <ToolOptions>
    <InterfaceProperties>
      <IspClock>50000</IspClock>
      <DebugWireClockDiv>50000</DebugWireClockDiv>
    </InterfaceProperties>
    <InterfaceName>ISP</InterfaceName>
  </ToolOptions>