Author Topic: Attiny44 cannot change status of pin  (Read 3252 times)

0 Members and 1 Guest are viewing this topic.

Offline dan3460Topic starter

  • Frequent Contributor
  • **
  • Posts: 326
  • Country: us
Attiny44 cannot change status of pin
« on: March 21, 2017, 11:44:45 am »
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.
 

Offline sleemanj

  • Super Contributor
  • ***
  • Posts: 3024
  • Country: nz
  • Professional tightwad.
    • The electronics hobby components I sell.
Re: Attiny44 cannot change status of pin
« Reply #1 on: March 21, 2017, 12:41:28 pm »
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... 
~~~
EEVBlog Members - get yourself 10% discount off all my electronic components for sale just use the Buy Direct links and use Coupon Code "eevblog" during checkout.  Shipping from New Zealand, international orders welcome :-)
 

Offline dan3460Topic starter

  • Frequent Contributor
  • **
  • Posts: 326
  • Country: us
Re: Attiny44 cannot change status of pin
« Reply #2 on: March 21, 2017, 03:26:57 pm »
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  :-//
« Last Edit: March 21, 2017, 03:28:55 pm by dan3460 »
 

Offline sleemanj

  • Super Contributor
  • ***
  • Posts: 3024
  • Country: nz
  • Professional tightwad.
    • The electronics hobby components I sell.
Re: Attiny44 cannot change status of pin
« Reply #3 on: March 21, 2017, 08:15:05 pm »
there are in different registers the LED is on the A register and the SDA is on the B register

Better check your code. As you wrote correctly in your first post SDA is in port A, not port B as you wrote above.

~~~
EEVBlog Members - get yourself 10% discount off all my electronic components for sale just use the Buy Direct links and use Coupon Code "eevblog" during checkout.  Shipping from New Zealand, international orders welcome :-)
 

Offline dan3460Topic starter

  • Frequent Contributor
  • **
  • Posts: 326
  • Country: us
Re: Attiny44 cannot change status of pin
« Reply #4 on: March 21, 2017, 09:17:41 pm »
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.

 

Offline dan3460Topic starter

  • Frequent Contributor
  • **
  • Posts: 326
  • Country: us
Re: Attiny44 cannot change status of pin
« Reply #5 on: March 22, 2017, 11:46:22 am »
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?
 

Offline sleemanj

  • Super Contributor
  • ***
  • Posts: 3024
  • Country: nz
  • Professional tightwad.
    • The electronics hobby components I sell.
Re: Attiny44 cannot change status of pin
« Reply #6 on: March 22, 2017, 12:18:47 pm »
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.
~~~
EEVBlog Members - get yourself 10% discount off all my electronic components for sale just use the Buy Direct links and use Coupon Code "eevblog" during checkout.  Shipping from New Zealand, international orders welcome :-)
 

Offline beenosam

  • Regular Contributor
  • *
  • Posts: 65
  • Country: ca
Re: Attiny44 cannot change status of pin
« Reply #7 on: March 22, 2017, 12:40:21 pm »
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?

See 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
 

Offline dan3460Topic starter

  • Frequent Contributor
  • **
  • Posts: 326
  • Country: us
Re: Attiny44 cannot change status of pin
« Reply #8 on: March 23, 2017, 11:35:12 am »
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.

As 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.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf