Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 25 of 25

Thread: Weird A6 behavior on Teensy 3.1

  1. #1

    Weird A6 behavior on Teensy 3.1

    Hey folks. I am using the sparkfun XBee shield w/the teensy 3.1 and I have some problems. My hot prob is that A6 is acting bonkers. All my analog pins will do an analogRead just fine except A6. A6 is just stuck at like 986. If I touch the pad with the jumper I have plugged in to my circuit 's sensor she jumps to 1021 and does not move even if I change the sensor output.

    Now here's the weird bit - it behaves perfectly as an analogWrite pin - no issues at all. It gladly goes from 0-3.3V no problems as expected.

    I can promise you all this isn't a code issue (I teach pcomp for a living at the University level and have an MS from an Engineering school).

    Why is only this pin being weird. It's consistent.

    Thoughts? Anyone else seen this? It's a first gen teensy 3.1 and I bought it out of the vending machine at NYU resistor. She's legit hardware.

    Now my bottom row of header pins are soldered in tossing just the teensy on a breadboard isn't an easy affair. It's my last one!

  2. #2
    Senior Member
    Join Date
    Dec 2016
    Location
    Montreal, Canada
    Posts
    3,270
    I worked in the IT field and we've seen people who claim to be MCSE certified yet they managed to bend the pins on the cpu/mainboard. Even the most perfect coder in the world can make mistakes, not saying it's you, just saying in general.

    could you post a pic of the teensy and your wiring?

  3. #3
    It's the same wiring and same code that works on every other analog pin - it's the pin. I'm just asking to see if this is a known problem, not to debug a circuit I am positive works down an entire row of pins and suddenly quits working on a specific pin.

  4. #4
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    6,552
    Only one pin damaged sounds a bit strange.. :-)
    But ok, may be possible.
    I guess, it's a software-problem. Either in your code or maybe, in the core-lib ?
    If you post some code, i can try it on a 3.1

  5. #5
    int pin = A6;
    void setup(){
    Serial.begin(9600);
    }
    void loop()
    {
    int val = analogRead(pin);
    Serial.println(val);
    }

  6. #6
    I just verified the bug again by repatching the circuit again. Works fine on A5 - got to A6? Borked data.

  7. #7
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    6,552
    It works fine on A5 and A6 on my T3.1

  8. #8
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    6,344
    I second what #tonton mentioned, pictures help to clarify things. Example: people don't mention that they have not soldered the pins into the Teensy and hope friction will make good connections or pins ... Or don't describe the complete setup.

    Example: I may be confused here but how do you plug the XBee Shield into a Teensy?
    My assumption is maybe you are using a sparkfun Teensy Arduino shield? https://www.sparkfun.com/products/13288

    If so how are you using A6? I believe the only place it comes out is to a jumper that allows you to use A6/A7 for the SCL/SDA pins instead of the default A4/A5 pins.

    But again only guessing

  9. #9
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    6,552
    Good catch, Kurt

  10. #10
    I'm' using this https://www.sparkfun.com/products/13311 actually

    A6 looks like it's not SCL on the eagle schematic - A conflict was my first thought too

    Notice that A7 is a bit wacky which is why I was testing. I stripped a reversed set of pins of the teensy b/c I had been using the audio shield. I thought maybe I hurt it What is so weird to me is A6 behaves great as a PWM pin.

    https://www.dropbox.com/s/wjl22valii...38426.jpg?dl=0

  11. #11
    Ground is just cut off in the photo - it's plugged to in on the other side. Sorry not going to upload another photo now. It's my data plan and I can't get my phone on wifi at work. I will later though if folks really need to see it.

  12. #12
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    6,552
    Do you have a multimeter/voltmeter ? Can you measure the voltage on A6 - just to be sure ?

  13. #13
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    6,344
    Thanks, it helps to see pictures and know which product...

    If it were me, I would probably try touching all of the pins again with solder iron and make sure good contacts. And/or I would use Ohm meter and measure the resistance from the pin on the Teensy to your breadboard.

  14. #14
    Now I have my meter and I am at home, that's my first move!

  15. #15
    Ok my scope is giving me the same thing - I just get a steady 3.3V no mater what I do on A6 and on A7 it does exactly what you'd expect which is vary the voltage with light the full range.

    The pin only works as PWM and only as output.

    Also tighten all my joints under magnification with my good iron.

  16. #16
    OK problem found https://cdn.sparkfun.com/datasheets/...sy_Adapter.pdf
    Even on this one as on the one that Kurt posted A6 is tied to SDA - problem solved.
    It works but not really and might be a problem to use! OK Got it.

  17. #17
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    21,474
    FWIW, I tested just now as well. Works fine. I tested twice, with the green Teensy 3.1 from the last batch we ever made (with the white pushbutton), and a black Teensy 3.1 from the very first batch. Both work fine. I tested on a breadboard.

    Click image for larger version. 

Name:	t31.jpg 
Views:	53 
Size:	52.1 KB 
ID:	9488

  18. #18
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    21,474
    If you're using that Sparkfun product, watch out for these issues too:

    https://forum.pjrc.com/threads/33280...l=1#post103798

  19. #19
    Thank you! Yes - it's the shield. I'll read up on the other link. I really, really regret not getting the pink one. Dear lord, I think of that fondly. Thank you for checking for me!

    Phoenix
    PS. I have a different shield and it seems to be ok so far. Should I put that 10k resistor between reset and 3.3v on mine?
    Last edited by phoenixperry; 01-24-2017 at 09:22 PM.

  20. #20
    Senior Member
    Join Date
    Aug 2013
    Location
    Gothenburg, Sweden
    Posts
    295
    The UART/SUART switch is on your XBEE board is connected to 20/A6 and 21/A7. So if the switch is in SUART position then weird things might happen.

  21. #21
    Ok! So - on to new problem with this same shield.
    I'm using the sparkfun explorer to receive serial data. I have the radios set up as serial pass through. I'm doing nothing at all tricky other than writing serial data.
    This is the code I am using:
    int val = 0;
    void setup() {
    // put your setup code here, to run once:
    val = 0;
    Serial.begin(9600);
    }

    void loop() {
    int val2 = val + 10;
    val = val2;
    if(val2 > 100){
    val = 0;
    }

    Serial.println(val);
    delay(200);

    }

    Next step is I make sure the xbee isn't attached and I program the teensy. No problems - all goes well.
    I plug the teensy into an external power supply via the teensy USB port spitting 3.23 (on average according to my scope) with the xbee now attached.
    I open up xctu and connect to my sparkfun explorer via the USB port to monitor the received serial data.
    I get nothing.

    I am pretty sure the radios are configured correctly. If I just pop the radio off the teensy/xbee shield and into an Uno / Seeed shield and power that, my sparkfun explorer gets the data as expected.

    I have the switch put in uart1 mode, which I think is correct for this code as I'm not using the software serial port.

    Any guesses as to why my teensy isn't getting data out to my xbee? I ran my scope into the shield with the teensy & xbee on it and these are the voltages at on the xbee pins:
    VCC: 2.7
    DIN: 2.7
    DOUT: 2.66

    So - the xbee isn't getting 3.3 - our VCC out after the xbee pulls voltage is too low.

    Here's my fear. I plug into the power rail and bye bye little teensy!

    I'm only using a series 1 xbee with an external antenna. It should be more than fine off the 3.23 volts. The guide for hooking this shield up (https://www.sparkfun.com/products/13032) infers it should be fine just running the power into the teensy unless I am totally misunderstanding it.
    I know it's not exactly 3.3 but there's some variance on the from your standard wall socket.

    If I remove the xbee and read the VCC with the teensy powered from the wall 3V supply I get a stable 2.91v

    Thoughts? Suggestions?

    Not enough power?
    Thanks everyone!
    Last edited by phoenixperry; 01-25-2017 at 08:54 AM.

  22. #22
    I'm following this with this link http://www.digi.com/resources/docume...power_reqs.htm
    which now leads me to think it's got ample voltage as it's getting 3V at the supply before I plug the xbee in on the VCC pin.

    Also, my power supply is up to 350mA of current just in case people are curious.

    Another odd thing is if I send keystrokes to the teensy / xbee shield externally from xctu via the explorer, the light on the DOUT pin lights up. I would think it would be DIN as I'm sending data in to it.

    Here are photos:

    Teensy w/shield (usually plugged in - I just have it swapped out right now b/c I made sure the code was indeed the same on it and the UNO)
    https://www.dropbox.com/s/9y91f2dr3l...00019.jpg?dl=0

    Teensy sending 0 data
    https://www.dropbox.com/s/p7rfvexfyi...36831.jpg?dl=0

    Moving the radio from the teensy / xbee shield to my uno / seeed shield with the same code
    https://www.dropbox.com/s/j25xn831is...28086.jpg?dl=0

    Data coming in as it should to xctu out of the UNO
    https://www.dropbox.com/s/itb1p801yx...COVER.jpg?dl=0
    Last edited by phoenixperry; 01-25-2017 at 09:19 AM.

  23. #23
    Just stepped up the power supply to a lipo 3.7V source and now it's getting 3.3V out of VCC on the Xbee. It's definitely got power the power it would need to work so that's one possible eliminated.
    Here's a photo - with my moustache power supply
    https://www.dropbox.com/s/wmzebjt26x...46103.jpg?dl=0

  24. #24
    Senior Member
    Join Date
    Nov 2012
    Posts
    273
    On Teensy, Serial is USB Serial and the first HardwareSerial port (pin 0 and 1) is Serial1.

    https://www.pjrc.com/teensy/td_uart.html
    The most common issue with serial ports on Teensy is use of code designed for Arduino Uno with Serial within the code. On Teensy, Serial accesses the USB. For hardware serial ports, Serial1, Serial2, Serial3, Serial4, Serial5 or Serial6 must be used.

  25. #25
    OMG - thank you it works!
    Last edited by phoenixperry; 01-25-2017 at 10:19 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •