All:
I am trying to build a IR receiver IN to I2C command out controller using a 5V trinket. I am able to decode IR codes (pin 2 input and in another wireup send I2C (pins 0, 2 output) commands. I can't currently wire these functions together as I am unable to find a pinout set that will work.
I need:
input for IR reciever
output for SDL
output for SCK
I've tried using pins 3 and 4, but with the USB conflict (and the need for a pullup) this won't work for the IR receiver.
Does anyone know if the I2C functionality provided by TWI can be reassigned? I think the following might might work:
Pin 0 - SDA
Pin 1 - SCL (trinket would be driving both I2C clock and LED)
Pin 2 - IR receiver.
I've followed the software documentation down, but have been unable to find the setup call in TWI to reassign the pins.
Thoughts?
Peter
Reassigning I2C pins
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- egutting
- Posts: 297
- Joined: Wed Nov 14, 2012 12:57 am
Re: Reassigning I2C pins
Why not use pin 1 for the IR receiver and keep the default I2C pins?
- pmeyer
- Posts: 24
- Joined: Sun Mar 23, 2014 3:16 pm
Re: Reassigning I2C pins
Hi:
The idea has merit. I would need to remove the R5 resistor or the LED. The other problem is that the boatloader flashes Pin 1 (the LED). Any restart of the trinket would cause a bus contention between the trinket and the IR receiver.....
I've can spare one of my Trinkets and so will give this a try.
P
The idea has merit. I would need to remove the R5 resistor or the LED. The other problem is that the boatloader flashes Pin 1 (the LED). Any restart of the trinket would cause a bus contention between the trinket and the IR receiver.....
I've can spare one of my Trinkets and so will give this a try.
P
- pmeyer
- Posts: 24
- Joined: Sun Mar 23, 2014 3:16 pm
Re: Reassigning I2C pins
So I cut away the pin 1 LED and can now get this pin to behave like a proper input. The only remaining problem is that the bootloader puts the pin into output mode to flash the (now missing) LED.
I will post another forum question regarding how to install modified bootloader code.
I think this mod is worthy of a separate learn session. I can reclaim another pin and use it as an input.
Peter
I will post another forum question regarding how to install modified bootloader code.
I think this mod is worthy of a separate learn session. I can reclaim another pin and use it as an input.
Peter
- AnneBarela
- Learn User Page
- Posts: 757
- Joined: Sat Mar 24, 2012 8:56 pm
Re: Reassigning I2C pins
I have successfully used pin 1 on the original trinket as an input in many projects without removing the onboard parts. You have to be aware of the resistance already there. Often a 1k pull up works well.
- pmeyer
- Posts: 24
- Joined: Sun Mar 23, 2014 3:16 pm
Re: Reassigning I2C pins
Hi thekitty:
I tried to connect a IR receiver device (from the data sheet has a 30k pullup with active low transistor). I was unable to get the IR receiver to be understood by the Trinket (although the LED should not have been able to light up). Once I removed the LED, the trinket was able to capture the IR's digital stream.
My concern was about the scenario whereby the IR receiver and Pin 1 (while booting) were both active. I can find max drive currents for the Tiny's IO drivers, but could not determine if the IR Receiver can tolerate pulsed 20mA current from Pin1 through its pull-down driver.
Thoughts?
Peter
I tried to connect a IR receiver device (from the data sheet has a 30k pullup with active low transistor). I was unable to get the IR receiver to be understood by the Trinket (although the LED should not have been able to light up). Once I removed the LED, the trinket was able to capture the IR's digital stream.
My concern was about the scenario whereby the IR receiver and Pin 1 (while booting) were both active. I can find max drive currents for the Tiny's IO drivers, but could not determine if the IR Receiver can tolerate pulsed 20mA current from Pin1 through its pull-down driver.
Thoughts?
Peter
- hiduino
- Posts: 862
- Joined: Sat Sep 01, 2012 7:05 pm
Re: Reassigning I2C pins
Were you able to try the updated bootloader without the LED_BLINK code from your other post?
- pmeyer
- Posts: 24
- Joined: Sun Mar 23, 2014 3:16 pm
Re: Reassigning I2C pins
Alas no. In my other post, I posted logs from the Serial console session on the Ardruino to the trinket. I also posted the first 10 columns of the .HEX file. (The sequence look like the .hex puts out addresses on its first 8 characters after the ": ) I think I must be missing an option in the linker to map it to the correct address space on the trinket. I have not had time to investigate this further.
- hiduino
- Posts: 862
- Joined: Sat Sep 01, 2012 7:05 pm
Re: Reassigning I2C pins
Did you check that other posting lately? There are responses on a bootloader to use.
- pmeyer
- Posts: 24
- Joined: Sun Mar 23, 2014 3:16 pm
Re: Reassigning I2C pins
All:
Using some reformatted/recompiled bootloader code provided by Hiduino, I have PIN 1 working as a clean input from a adafruit IR receiver.
I've been able to mash together two projects (adafruit-20w-stereo-audio-amplifier-class-d-max9744 amp, and the IR Receiver tutorials and have a Trinket reading IR codes and pushing I2C commands to the AMP's Digital volume control.)
Thanks all for your help!!
Peter
Using some reformatted/recompiled bootloader code provided by Hiduino, I have PIN 1 working as a clean input from a adafruit IR receiver.
I've been able to mash together two projects (adafruit-20w-stereo-audio-amplifier-class-d-max9744 amp, and the IR Receiver tutorials and have a Trinket reading IR codes and pushing I2C commands to the AMP's Digital volume control.)
Thanks all for your help!!
Peter
Please be positive and constructive with your questions and comments.