Go Down

Topic: ATTiny85 with 74HC595 not matching ? (Read 1 time) previous topic - next topic

hamisu-anguan


I has been programming using UNO and my project working well.  Then I try to switch to breadboard ATMega328P in TQFP is also working well. 


But I cant get my program to work on ATTiny85. The same program can run perfectly when I use ATMega328P-CU in TQFP. (Of course when i change to ATTiny, I have change the data, clock, latch pins according to ATTiny85 pin configuration).   

My program is just reading the variable resistors and shift out the output into two shift registers of 74HC595. Because i think the number of pins in ATTiny85 is sufficient to run this project, so I do not want to use excess pins in ATMega328P. 

The only different i thought is in ATTiny85, I cant have external crystal and I thought is the speed to slow, then I try burn bootloader for the ATTiny to 8MHz, it is still not working even though all upload is perfect.  There is no errors.

Could someone experience this tell me what is the different and how to get this work ?






Smajdalf

The error on line 131 of your sketch explains the behavior you described.
On 8-bit (i.e. Uno) use "byte" instead of "int" if possible - it is faster and saves resources!

DrAzzy

Probably a bug in the code that compromises compatibility. Post the entire sketch (no snippets - it's never in the snippet you think it is).

Also, what board package are you using to add support for the ATTiny85? Mine, or some other one?
ATtiny core for 841+1634+828 and x313/x4/x5/x61/x7/x8 series Board Manager:
http://drazzy.com/package_drazzy.com_index.json
ATtiny breakouts (some assembled), mosfets and awesome prototyping board in my store http://tindie.com/stores/DrAzzy

hamisu-anguan


I attached the entire code.

DrAzzy

Which board package are you using to add support for ATTiny85?

There are two currently maintained attiny board packages, plus dozens of abandoned versions around the internet, and they are NOT all the same.
ATtiny core for 841+1634+828 and x313/x4/x5/x61/x7/x8 series Board Manager:
http://drazzy.com/package_drazzy.com_index.json
ATtiny breakouts (some assembled), mosfets and awesome prototyping board in my store http://tindie.com/stores/DrAzzy

Smajdalf

This is likely wrong:
int probe = PB2;
I guess you are reading wrong pin because naming of digital pins is different from naming of analog pins. Try probe = 1;
On 8-bit (i.e. Uno) use "byte" instead of "int" if possible - it is faster and saves resources!

hamisu-anguan

I have try naming with numerical number is still not working.

DrAzzy

Which attiny board package are you using???
ATtiny core for 841+1634+828 and x313/x4/x5/x61/x7/x8 series Board Manager:
http://drazzy.com/package_drazzy.com_index.json
ATtiny breakouts (some assembled), mosfets and awesome prototyping board in my store http://tindie.com/stores/DrAzzy

Smajdalf

You should
1) answer DrAzzy's question
2) try to describe "not working"
3) try to isolate the problem: are you able to turn on/off simple LED? Are you able to shift (constant) data to the shift register? Are you able to read the ADC value properly?
On 8-bit (i.e. Uno) use "byte" instead of "int" if possible - it is faster and saves resources!

hamisu-anguan


I am using ATTiny/UNO on board shield for ATTiny connected UNO. I can upload program and turn on LED with a simple blink program without issue. May be I shall breakdown the code to check the ADC value using serial monitor. I have not done that.

wilykat

You still haven't answered one question: there are a few different ATTiny cores for Arduino IDE and not all have the same pin naming or coding.  Which one are you using?  Those are listed in Board section of Arduino IDE.  On my IDE I have attiny by David A Mellis v1.0.2

hamisu-anguan


Yes. I am using David Mellis core, but I dont know what version. I follow the instruction here.

https://www.hackster.io/arjun/programming-attiny85-with-arduino-uno-afb829

Now, I try to install the SpenceKonde core. But I during installation, I have error as below.

I am not sure due to server issue or network issue.





hamisu-anguan


after downloaded, CRC mismatch error. Pls help.

DrAzzy

Can anyone else confirm whether this problem is happening for them? I can't test it until I get home late tonight.
ATtiny core for 841+1634+828 and x313/x4/x5/x61/x7/x8 series Board Manager:
http://drazzy.com/package_drazzy.com_index.json
ATtiny breakouts (some assembled), mosfets and awesome prototyping board in my store http://tindie.com/stores/DrAzzy

kprims

I went from version 1.1.4 to 1.1.3 and back to version 1.1.4 without a problem.

Go Up