Trinket + Softwareserial?

Adafruit's tiny microcontroller platform. Please tell us which board you are using.
For CircuitPython issues, ask in the Adafruit CircuitPython forum.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
theman8631
 
Posts: 40
Joined: Mon Sep 23, 2013 2:31 am

Trinket + Softwareserial?

Post by theman8631 »

I'm trying to use the Camera tutorial on the SD card breakout board and Miniature TTL Serial Camera together with the Trinket Pro 3v. I'm using the snapshot example and I've compiled and sent it to the trinket.

At first I had a bit of a hard time compiling, softwareserial didn't work with the 12Mhz trinket but I believe I've found code via: http://fuzz4dev.BANNED.com/tag/12mhz/ towards the bottom to get it to "work" with 12Mhz.
I've set softwareserial to the correct pins, It compiles and sends however,

In serial the trinket identifies SD Card fine, however says "Camera Not Found". I'm assuming that the softwareserial object created isn't constructed in a way that is retrieving properly. Is this a correct assumption? Is there another library I should be using to compile this?

Thank you for your help!

User avatar
adafruit_support_bill
 
Posts: 88088
Joined: Sat Feb 07, 2009 10:11 am

Re: Trinket + Softwareserial?

Post by adafruit_support_bill »

I haven't tested the library modifications you linked. Have you verified that they work correctly at the camera's baud-rate? (57600 if I remember correctly).

User avatar
AnneBarela
Learn User Page
 
Posts: 757
Joined: Sat Mar 24, 2012 8:56 pm

Re: Trinket + Softwareserial?

Post by AnneBarela »

The Trinket classic defaults to 8 MHz. It can be ramped up in software to 16 MHz. It would take custom commands to have it run at 12 MHz.

The standard SoftwareSerial works fine on Trinket at 8 or 16 MHz.

User avatar
theman8631
 
Posts: 40
Joined: Mon Sep 23, 2013 2:31 am

Re: Trinket + Softwareserial?

Post by theman8631 »

The code mentions that baud rate but I havnt confirmed it works personally. Considering kitty's post I am curious if the trinket pro can go up to 18mhz safely and I can use software serial that way? Otherwise I'm having a hard time finding a softwareserial library that works with it

User avatar
adafruit_support_bill
 
Posts: 88088
Joined: Sat Feb 07, 2009 10:11 am

Re: Trinket + Softwareserial?

Post by adafruit_support_bill »

I don't know what the timing tolerances of the camera or the modified library are, but generally, the faster you go the more critical they are. I know that SoftwareSerial can be iffy at 115200 on a 16MHz Arduino.

You might be able to get the 5v version to run at 3.3v/16MHz. That clock-speed rating is only guaranteed at 5v by Atmel, but many samples can be 'overclocked' just fine.

User avatar
theman8631
 
Posts: 40
Joined: Mon Sep 23, 2013 2:31 am

Re: Trinket + Softwareserial?

Post by theman8631 »

The tutorial says the default baud rate is 38400 so hopefully the iffy-ness you mentioned is less iffy.

If I can get trinket to run at 18mhz I'll try that first.

If no dice then I'm going to try to replace the trinket with an uno to make sure it's something to do with the trinket and not something silly I'm doing.

User avatar
theman8631
 
Posts: 40
Joined: Mon Sep 23, 2013 2:31 am

Re: Trinket + Softwareserial?

Post by theman8631 »

I meant 16 Mhz rather ^^

Well tried that and things went bananas. Serial read was gibberish so yeah.

I'll try the uno and tutorial vanilla tomarrow, I'm sure it will work.
Could it be the pins I've set the trinket to possibly? I have the camera's RX on trinket pin 9 and TX on 10, and respectively in the code:
SoftwareSerial cameraconnection = SoftwareSerial(10, 9);

User avatar
theman8631
 
Posts: 40
Joined: Mon Sep 23, 2013 2:31 am

Re: Trinket + Softwareserial?

Post by theman8631 »

Or can I / should I, use something like http://www.adafruit.com/blog/2013/09/30 ... e-trinket/

User avatar
adafruit_support_bill
 
Posts: 88088
Joined: Sat Feb 07, 2009 10:11 am

Re: Trinket + Softwareserial?

Post by adafruit_support_bill »

I'd give Frank's 'Hardware Serial' a try.

User avatar
theman8631
 
Posts: 40
Joined: Mon Sep 23, 2013 2:31 am

Re: Trinket + Softwareserial?

Post by theman8631 »

USISerial wont even compile:

Long list of undeclared variables in USI_UART.c

:/

User avatar
adafruit_support_bill
 
Posts: 88088
Joined: Sat Feb 07, 2009 10:11 am

Re: Trinket + Softwareserial?

Post by adafruit_support_bill »

USISerial wont even compile:
Are you trying to compile it directly, or include it as a library?
Try compiling the UsiSerialEcho example.

User avatar
theman8631
 
Posts: 40
Joined: Mon Sep 23, 2013 2:31 am

Re: Trinket + Softwareserial?

Post by theman8631 »

Those errors are from compiling the example sketch you mentioned. It references the errors occurring in the library itself though

User avatar
hiduino
 
Posts: 862
Joined: Sat Sep 01, 2012 7:05 pm

Re: Trinket + Softwareserial?

Post by hiduino »

That UsiSerial library is written for an attiny mcu, the standard Trinket. I don't think it was meant to work the the Trinket Pro.

Locked
Please be positive and constructive with your questions and comments.

Return to “Trinket ATTiny, Trinket M0”