0
\$\begingroup\$

I have 3 devices on SPI: Atmega328P, ZM5202 and flash with CS.
When I connect Reset of Atmega to GND I cannot talk with other ZM5202. And then I am reading id of avr also.
When avr programming:
AVR Reset -> reset of programmer
ZM5202 Reset -> Gnd
CS -> high
Result: OK


When Memory programming:
AVR Reset -> Gnd
ZM5202 Reset -> Gnd
CS -> low
Result: OK


When ZM5202 programming:
AVR Reset -> gnd
ZM5202 Reset -> programmer reset
CS -> high
Result: NOK


but

When ZM5202 proramming:
AVR Reset -> floating
ZM5202 Reset -> programmer reset
CS -> high
Result: OK


In programming cycle I can set timings:
I switch on the power for 100ms then 100ms off and after that on again for programming routine.
Do You have idea why AVR is not in reset when Reset pin connected to GND?
Fuses are not blocking ResetPin. They are low:FF, high:DA, ext: FD

\$\endgroup\$
  • \$\begingroup\$ Apparently the AVR reset is working in 3 out of 4 conditions. The question is why does the AVR appear to interfere with programming the ZM5202 when it is in reset? Perhaps the problem is caused by some other pin that floats when the AVR is in reset, or perhaps it's a cabling issue (capacitance, ground loop etc.). Without knowing how everything is connected it's hard to guess, so... can you show us the circuit diagram and/or a photo of the device with programmer connected? \$\endgroup\$ – Bruce Abbott Oct 12 '16 at 18:55
0
\$\begingroup\$

When ZM5202 programming: AVR Reset -> gnd; ZM5202 Reset -> programmer reset; CS -> high; Result: NOK

No surprises here: The AVR turns on its ISP interface in Reset and drives one of the SPI lines, preventing the ZM5202 from doing the same.

It would also try to read the data as ISP commands, so you could end up with erased or modified memory on the AVR by accident.

AVR Reset -> floating

The AVR has a weak internal pullup on its reset pin. This means floating => not in Reset.

\$\endgroup\$
  • \$\begingroup\$ Any ideas how to solve this? \$\endgroup\$ – Lukasz Oct 12 '16 at 12:05
  • 1
    \$\begingroup\$ @Turbo J: I'm not sure this is true. Atmel's documentation at atmel.com/Images/doc0943.pdf states: "When Reset is applied to the target AVR microcontroller, the MISO pin is set up to be an input with no pull up. Only after the “Programming Enable” command has been correctly transmitted to the target will the target AVR microcontroller set its MISO pin to become an output." Of course it can still be dangerous to try to use SPI with the AVR in reset since the Programming Enable command might appear in the SPI data after which the AVR turns it MISO to an output. \$\endgroup\$ – Olof Oct 12 '16 at 12:36
-1
\$\begingroup\$

[SOLVED] put clock 500kHz to Resets when not used.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.