Attiny44 cannot change status of pin - Page 1
Forum section: electronics / general

author: dan3460
author_rank: Frequent Contributor
timestamp: March 21, 2017, 11:44:45 am
content: I'm implementing TWI on a Attiny44, SDA in located on pin 7 (PA6) and SCL on pin 9 (PA4). I have gotten, from the internet, several implementations of TWI on USI and I'm developing my own library. I have also placed two 10k resistors on those lines.So, the first thing I did was to initialize TWI, I was expecting both pins to go high but I only got SCL high. Because pin 7 is also MOSI, I thought that maybe the programmer was pulling the pin down, so I disconnected the wire from the programmer, no luck.Next thing I did was to comment out anything that was setting up TWI and set the pin directly as an output pin, I did the same with pin 3 PB1 and install a LED, and blink both pins high and low. I can see the LED blinking, my scope shows at flat line at 0V on SDA.Because that pin is used for programing I suspect that is a software issue instead of hardware.Is there any trick to release the SDA pin? Is anyone experience similar thing?Thanks for the help.

author: sleemanj
author_rank: Super Contributor
timestamp: March 21, 2017, 12:41:28 pm
content: When your firmware boots, all pins are input state (except for reset and xtal pins as dictated by fuses of course), there is no trick to it.Ensure you are setting the appropriate pins as output, you wouldn't be the first to mistake turning on and off the pullup on an input pin for toggling an output and if you had pulldowns externally as well...

author: dan3460
author_rank: Frequent Contributor
timestamp: March 21, 2017, 03:26:57 pm
content: humm, this is interesting. I know that I have set the pins for outoput, the LED is blinking on the other pin, there are in different registers the LED is on the A register and the SDA is on the B register, but the only commands that I have are identical except for the register used.puzzled

author: sleemanj
author_rank: Super Contributor
timestamp: March 21, 2017, 08:15:05 pm
content: Quote from: dan3460 on March 21, 2017, 03:26:57 pmBetter check your code. As you wrote correctly in your first post SDA is in port A, not port B as you wrote above.

author: dan3460
author_rank: Frequent Contributor
timestamp: March 21, 2017, 09:17:41 pm
content: Thanks, I switched the ports on my previous posts. The code was correct, embarrassed to say it was the equipment.I had channel 1 probe on the SCL and the channel 2 on the SDA, because I'm still on the breadboard I used a wire connector between the probe and the hole on the breadboard, the wire had broken. I had the signal there all the time. Sorry to waste everyone's time.

author: dan3460
author_rank: Frequent Contributor
timestamp: March 22, 2017, 11:46:22 am
content: I have another related question. On my quest to understand the problem, I had all pins from register A blinking. After realizing my mistake, I started to work on the actual program. Started with a blank (only the main function, with an empty while statement) and flush that on the chip, to make sure that I have control of the chip.When I did that to the test chip, I got a non communication error, I check all the connection and try Arvdudess to read the memory, same communication error. While testing I had programmed the chip several times with no issues. Just to make sure I put a new chip in there and I was able to flush that empty program. Odd, I thought. Kept working flushing a few version of the program to test the function, suddenly I could not program the chip again, same no communication error. Just to confirm, I put the last Attiny44 and I was able to program it.Did I bricked the other 2 chips?Now, the program that I'm writing a TWI program that uses two pins that are used by the programmer, but it is my understanding that the programmer will push reset low stopping all execution allowing for programing.I'm correct on the assertion?

author: sleemanj
author_rank: Super Contributor
timestamp: March 22, 2017, 12:18:47 pm
content: Most likely cause, you accidentally set incorrect fuses and the chip is expecting an external clock/xtal which is not connected, or you disabled reset or spi programming fuses.

author: beenosam
author_rank: Regular Contributor
timestamp: March 22, 2017, 12:40:21 pm
content: Quote from: dan3460 on March 22, 2017, 11:46:22 amSee this thread for a potential explanation of how to fix your problem:https://www.eevblog.com/forum/microcontrollers/atmega-328p-not-responding-to-usbasp/msg1144905/#msg1144905

author: dan3460
author_rank: Frequent Contributor
timestamp: March 23, 2017, 11:35:12 am
content: Quote from: sleemanj on March 22, 2017, 12:18:47 pmAs you said that, I have two upload commands on my Atmel Studio; one of the 328P and the other for the 44, is very possible that I hit the wrong one.