Go Down

Topic: SoftwareSerial with ATTiny84 using ATtiny library (Read 55198 times) previous topic - next topic

Erni

#120
Feb 28, 2013, 02:48 pm Last Edit: Feb 28, 2013, 03:10 pm by Erni Reason: 1
I am confused too.
I think it would be a good idea if you describe your project in more detail. It is unclear how many and which pins you are expecting to use and for what purpose.

Just to be clear that we are talking about the same:

The Capacitive Sensing Library ned a sense and receive pin
http://playground.arduino.cc//Main/CapacitiveSensor?from=Main.CapSense

If you are using TinyISP and knockbang , the serial output form attiny is pin PB1 (physical pin 6) connected to pin pin 12 on the UNO,
This is also the reason why you should not use this pin as sense pin, as I tryed to explain

That leaves you with 2 pins (three if you use the reset pin)




hilukasz


I am confused too.
I think it would be a good idea if you describe your project in more detail. It is unclear how many and which pins you are expecting to use and for what purpose.

Just to be clear that we are talking about the same:

The Capacitive Sensing Library ned a sense and receive pin
http://playground.arduino.cc//Main/CapacitiveSensor?from=Main.CapSense

If you are using TinyISP and knockbang , the serial output form attiny is pin PB1 (physical pin 6) connected to pin pin 12 on the UNO,
This is also the reason why you should not use this pin as sense pin, as I tryed to explain

That leaves you with 2 pins (three if you use the reset pin)






ok this is where I am confused. I have the capacitive sensor hooked up to the attiny not the arduino (maybe that is where the confusion is). you say "using 0 and 1 you are interferring with MISO" I don't see how that will interfere with MISO on attiny...? nor did I know it even had it.

Those sketches I have up there are both uploaded to the attiny, I have capacitive sensor on 0 and 1 of attiny. and reading serial from attiny on PB3 (I thought this was default, I have always used this and it used to work fine) going into Tx of arduino. But I also leave it plugged into the programming board, but not sure if this will cause any unexpected errors.

let me know if this clears it up or if its still confusing.
for(i = 0, i < 820480075, i++){ Design(); Code(); delay(1000); } // hellowoo.com

Erni

#122
Mar 01, 2013, 01:38 pm Last Edit: Mar 01, 2013, 01:41 pm by Erni Reason: 1



Quote
ok this is where I am confused. I have the capacitive sensor hooked up to the attiny not the arduino


So do I   :D

Quote
nor did I know it even had it.


It does, see the picture above

Quote
you say "using 0 and 1 you are interferring with MISO" I don't see how that will interfere with MISO on attiny...?


Look at the picture PB1 (or 1) is MISO used by TinyISP to communicate with your Arduino

Quote
I have capacitive sensor on 0 and 1 of attiny


Again 1 is MISO

Quote
and reading serial from attiny on PB3 (I thought this was default, I have always used this and it used to work fine)


No, the default is PB1 when you are using TinyISP.


If you use TinyDebugSerial, the default is PB3

hilukasz





Quote
ok this is where I am confused. I have the capacitive sensor hooked up to the attiny not the arduino


So do I   :D

Quote
nor did I know it even had it.


It does, see the picture above

Quote
you say "using 0 and 1 you are interferring with MISO" I don't see how that will interfere with MISO on attiny...?


Look at the picture PB1 (or 1) is MISO used by TinyISP to communicate with your Arduino

Quote
I have capacitive sensor on 0 and 1 of attiny


Again 1 is MISO

Quote
and reading serial from attiny on PB3 (I thought this was default, I have always used this and it used to work fine)


No, the default is PB1 when you are using TinyISP.


If you use TinyDebugSerial, the default is PB3



Ohhhh, I was confusing myself because I was using a different core last time. it definitely had a different pin, i made suggestions you made and all is well. thanks for your patience :) everything is working as expected. so using TinyISP is 0 the serial in( like Rx on arduino)? this relationship kind of confuses me because I have output from attiny going into Tx of arduino, which I thought was transmit. I would expect it to go into Rx.
for(i = 0, i < 820480075, i++){ Design(); Code(); delay(1000); } // hellowoo.com

40087178

Hi, I would need some help to bring my ATTiny85 to life.

My goal is to establish a serial communication on my Tiny.
I've already spent long hours for looking a working solution but with no luck :/.

Tried various libraries, settings, pins .. so now I am stuck .
The scenario :

Arduino Bare - working fine
Uploaded a blinky sketch and that is working fine

Uploaded 2 kind of bootloaders (?) Various serial implementations.. I am confused :( Heeelp please.

I would be happy to start the whole process from the beginning because surely I missed something.. wrong bootloader, library..something..

Thanks !


Erni

If you can upload a working blink sketch to your Tiny, you should be able to use TinyDebugSerial, which is a one way communication.

Code: [Select]

void setup() {
  Serial.begin(9600);
}

void loop() {
  Serial.println("Testing..");
  delay(100);
}


The output from the tiny is pin PB3.

You the need a serial/usb converter to connect it to your computer/serial monitor

more on this:

http://www.ernstc.dk/arduino/tinycom.html

As you see you have other options:

1. TinyDebugSerial
2. SoftwareSerial
3. Use TinyISP and Tinyknockbang
4. Use TinyISP and Serial Relay
5. Use TinyISP and Nullmodem


sej7278

any idea what needs modifying to make TinyISP and TinyDebugKnockBang work on a Mega2560? I could probably figure out the pin changes, but I don't know what to put to replace the ( __AVR_ATmega328P__ ) #define's.

also is there a way to search a thread on this forum?

Coding Badly

any idea what needs modifying to make TinyISP and TinyDebugKnockBang work on a Mega2560?


I have a version that may work but I have no way to test it.  If you agree to provide feedback (that includes success) then I'm willing to publish.

Quote
also is there a way to search a thread on this forum?


I'm not aware of any way.

hiduino


I have a version that may work but I have no way to test it.  If you agree to provide feedback (that includes success) then I'm willing to publish.


I'll be willing to test it out also.  I've actually been trying to play with TinyISP on my mega2560 but didn't get too far with it.


Coding Badly



I have a version that may work but I have no way to test it.  If you agree to provide feedback (that includes success) then I'm willing to publish.

I'll be willing to test it out also.


Excellent.  Is delivery via Github acceptable?


If you don't mind, I'd like you to review the pin assignments for mistakes / opinions...

LED_PIN is assigned to digital pin 13.  TinyISP uses a single LED for status.  I chose the on-board LED.

TICK_TOCK_PIN is assigned to digital pin 47.  The "Tick Tock" pin is used as a basic chronograph.  When the pin toggles a timestamp is output.  It allows basic performance monitoring and tuning.  I have a version that uses Input Capture so I try to assign TICK_TOCK_PIN to ICP1 (Input Capture for Timer 1).

Knock-Bang is always assigned to MISO which is PB4 / digital pin 50.

The SPI pins are...
MISO is 50.
MOSI is 51.
SCK is 52.
SS is 53.

The SPI pin assignments are only relevant when PROGRAMMER_SPI_CLOCK == SLOW.  I believe the Arduino core provides the assignments.


There are two more things that will have to be assigned pins: "Tuning Signal" and "Alternate Knock-Bang". 

The Tuning Signal is one-half of a much improved Tiny Tuner.  For the m328 processor the Tuning Signal is currently placed on a timer 2 output (OC2B).  The only requirement is the pin must be a timer output.  A pin close to the target (close to the SPI pins) is helpful.

There are times when MISO cannot be used for Knock-Bang.  The Alternate is simply another choice for Knock-Bang.  The only requirement is the pin has to support Pin Change Interrupts.  I typically choose this pin based on physical location: a pin close to the SPI pins that does not conflict with any other pin assignment.

Finally, the Serial Relay code will have to be updated (this is a note to myself).


Quote
I've actually been trying to play with TinyISP on my mega2560 but didn't get too far with it.


The code is very poorly structured for porting so it's certainly understandable you ran into problems.  I had to grep for a few things and I wrote the thing.

hiduino

Yes, Github is fine.  I'll try to review it as detailed as I can.

I was able to at least get the TinyISP to build on the mega2560 and program a few ATtiny84/85s.  But not get the serial relay to work.  I didn't try knock-bang because I figured that required more work.  I'll wait for your code.


Coding Badly

Yes, Github is fine.  I'll try to review it as detailed as I can.


Ready for a test drive...
https://github.com/Coding-Badly/TinyISP

Quote
I was able to at least get the TinyISP to build on the mega2560 and program a few ATtiny84/85s.


Excellent.

Quote
But not get the serial relay to work.


I'll take a look at it tonight.  I doubt it will work without some changes.

Quote
I didn't try knock-bang because I figured that required more work.


It should be working now.

Thanks!


Coding Badly

How ever, a 100nF cap doesn't do much.


A 100nF capacitor connected to what?

hiduino

Ok, I know you said serial relay was note to yourself.  But I tried anyway and was able to get it to work with a Mega2560 and tiny84.  I made two changes to the code.

TinyISP_SelectBuildOptions.h (added support for Mega board):
Code: [Select]

#if (RELAY_SERIAL_ENABLED) && (BOARD_ARDUINO_MEGA)
  #define RELAY_SOFT_SERIAL_ENABLED  1
#endif


TinyISP_RelaySoftSerial.h (added support for different MISO pins):
Code: [Select]

#if (BOARD_ARDUINO_UNO)
  static SerialRelay RelaySerial( 12, 14 );
#endif

#if (BOARD_ARDUINO_MEGA)
  static SerialRelay RelaySerial( 50, 14 );
#endif


I will continue testing the other items.


hiduino

#134
Jun 14, 2013, 01:11 pm Last Edit: Jun 15, 2013, 09:10 am by hiduino Reason: 1
Knock-Bang failed to relay from both the Uno and Mega board types, with various tiny84/85/13 and various speeds 1MHz, 8MHz, 16MHz, 9.6 MHz, 4.8 MHz.
Code: [Select]

--- Monitor starting ---

--- Knock-Bang fault: 15 ---

--- Knock-Bang fault: 15 ---

--- Knock-Bang fault: 15 ---

--- Monitor stopped ---


However, going back to the previous version of TinyISP it worked fine on the Uno and various tinys.
Code: [Select]

--- Monitor starting ---
Caitlin!
Caitlin!
Caitlin!

--- Monitor stopped ---


Does TinyDebugKnockBang need to be updated also?

Go Up