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

Thread: PCA9685 Boards - ideal Wire settings for Teensy LC?

  1. #1
    Senior Member Pensive's Avatar
    Join Date
    Aug 2014
    Location
    Basingstoke, UK
    Posts
    562

    PCA9685 Boards - ideal Wire settings for Teensy LC?

    Hi guys

    My project is very complex, the only way to show you the wiring diagram would be to spend a few hours in fritzing, but I attach a photo below which probably won't help much.

    However I hope my question should be fairly simple, rather than describe my problem and ask for a solution, I'd rather ensure I'm talking to the devices correctly first.

    So the Question: what are the perfect settings for Wire with a prop shield and 2 * pca9685s, on a Teensy LC?

    I've got 16 WS2812Bs running via FastLED on pin 17 @ 5v, an analog mux 16 channel bringing in the button inputs running 3.3v, (see pins) and 6 RGB rotary encoders (https://www.sparkfun.com/products/10982), which I'm currently running on the 3.3v output of the Teensy including the RGB leds with 440ohm resistors pulling the current down fairly low on each of the RGB pins.

    I'm using 2 PCA9685 adafruit breakouts to control them : https://www.adafruit.com/product/815

    I also have a prop shield on the same i2c pins.

    If i just have everything connected, the LEDs power up fine, and the board runs perfectly. So the 9685 devices are doing nothing allowing a full load to be pulled. So I don't think it's total milliamp draw thats the issue. _think_.

    If i connect via wire to the two PCA9685 devices and switch the led outputs off ( or do anything else for that matter), the entire device starts screwing up, barely working, everything goes wrong, working digital inputs stop registering, neopixels start misbehaving, almost as if some bad interrupt code is ruining everything. I'm not using any interrupts at all in any of my code, except the wire library of course uses them.

    So i tried first modding the adafruit library to use the teensy specific wire library. No change.

    I then tried setting the opmode to DMA, but it doesn't seem to have any effect.

    So my question is this really - whats the ideal way of setting all this up in the wire library, should i reduce the i2c speed and run as DMA? any other advice?
    fastLED tweaks?

    I'm sorry it's such a complex project and my code is fairly sensitive at this point so I'm not sure i want to post it. I'm using "EVERY_N_MILLISECONDS" to run the polling functions in the loop, so I think tweaking the power draw issues and Wire settings is the firs thing to do.

    I'll order one of these to drive the LEDs power tomorrow so that should eliminate power supply being the issue: https://www.adafruit.com/products/2745

    I'm in USB_Midi mode so I don't get any serial output at the moment so I can't report debugging or CPU/mem as we go. I've tried linking in via arduino to use Pauls software serial solution (i use visual micro) but it doesn't seem to be working, not sure if its a port issue or what.

    Any advice most useful!!!

    Thanks

    Jon

    Click image for larger version. 

Name:	p1gutz.jpg 
Views:	190 
Size:	114.6 KB 
ID:	7860Click image for larger version. 

Name:	pinouts.jpg 
Views:	456 
Size:	153.0 KB 
ID:	7861
    Last edited by Pensive; 08-14-2016 at 07:58 AM. Reason: clarity

  2. #2
    Senior Member
    Join Date
    Jul 2014
    Posts
    2,347
    Quote Originally Posted by Pensive View Post
    I'm in USB_Midi mode so I don't get any serial output at the moment so I can't report debugging or CPU/mem as we go. I've tried linking in via arduino to use Pauls software serial solution (i use visual micro) but it doesn't seem to be working, not sure if its a port issue or what.
    Are you saying that Serial + midi does not provide you serial output you need, or does it not work? what is Pauls serial solution?

  3. #3
    Senior Member Pensive's Avatar
    Join Date
    Aug 2014
    Location
    Basingstoke, UK
    Posts
    562
    Paul worked his magic in Arduino IDE



    http://www.visualmicro.com/forums/Ya...1455569620/1#1

  4. #4
    Senior Member
    Join Date
    Jul 2014
    Posts
    2,347
    Quote Originally Posted by Pensive View Post
    Paul worked his magic in Arduino IDE



    http://www.visualmicro.com/forums/Ya...1455569620/1#1
    But meanwhile Paul has added a modified usb device (serial + midi) generating a native com port (at least on Windows). But I guess, this is not the issue of your OP.

  5. #5
    Senior Member Pensive's Avatar
    Join Date
    Aug 2014
    Location
    Basingstoke, UK
    Posts
    562
    Most useful nevertheless! Thank you!!

    I'll be able to get more info out of my project and use the visual micro debugging features now!

    Awesome

    Thanks

  6. #6
    Senior Member
    Join Date
    Jan 2013
    Posts
    843
    You should write a debug sketch, you may very well have a hardware issue.

    Start with a simple program to slowly blink the LEDs via the PCA9685 then add some function to control brightness or blink frequency via the encoder. Now add in something similar for the WS2812B, ...

  7. #7
    Senior Member Pensive's Avatar
    Join Date
    Aug 2014
    Location
    Basingstoke, UK
    Posts
    562
    Quote Originally Posted by tni View Post
    You should write a debug sketch, you may very well have a hardware issue.

    Start with a simple program to slowly blink the LEDs via the PCA9685 then add some function to control brightness or blink frequency via the encoder. Now add in something similar for the WS2812B, ...
    Wilco. I've definitely got something wierd going on.

    I reinstalled arduino & teensyduino to make use of the new Serial & Midi type, but none of my serial output is coming out.
    If I download the serial example from Teensyduino and set that to Serial& Midi, it works.....in both Arduino IDE and VisualMicro.

    It couldn't be any easier to get Serial right - so I think FastLED is messing some things up, despite running well.

    I'll find time tomorrow to start from the bottom and work up, getting everything working one thing at a time.

Posting Permissions

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