OctoWS and using ports 5-12 on Teensy 3.2

Status
Not open for further replies.

greg

Well-known member
Hi,

I only have a single LED strip in my project, and a bunch of other stuff, including stepper motors which I want to control from pins 5-12.

Problem is, when I use OctoWS, one of my steppers gets disabled for reasons I don't fully understand.

My stepper driver is DRV8825 , and I am using pin 5 for step, 6 for direction and 7 for enable/disable the motor.

Another stepper, which sits on pins 9,10,11 (Step/Dir/Enable) - is not affected.

I went ahead and commented out all but one of the strips (or so I think) in the OctoWS library, but it does not seem to help.

Anything I can do to prevent OctoWS from using ports 5,6 and 7?

Here it is:

Code:
void OctoWS2811::begin(void)
{
	uint32_t bufsize, frequency;

	bufsize = stripLen*24;

	// set up the buffers
	memset(frameBuffer, 0, bufsize);
	if (drawBuffer) {
		memset(drawBuffer, 0, bufsize);
	} else {
		drawBuffer = frameBuffer;
	}
	
	// configure the 8 output pins
        [B]// Greg Note: [/B]I commented out all other strips, leaving only pin 2 to drive the LEDs
	GPIOD_PCOR = 0xFF;
	pinMode(2, OUTPUT);	// strip #1
	//pinMode(14, OUTPUT);	// strip #2
	//pinMode(7, OUTPUT);	// strip #3
	//pinMode(8, OUTPUT);	// strip #4
	//pinMode(6, OUTPUT);	// strip #5
	//pinMode(20, OUTPUT);	// strip #6
	//pinMode(21, OUTPUT);	// strip #7
	//pinMode(5, OUTPUT);	// strip #8

The rest of the OctoWS library is untouched.
 
Since you only want to drive one LED strip, FastLED might be a better solution for you than OctoWS2811, which is designed to drive eight.

OctoWS2811 writes to port D, which is spread out among all eight of those pins. Simply commenting out those pinMode statements won't do anything, if you are using those pins for output somewhere else in your code. You might be able to move OctoWS2811 to a completely different port, which will cause it to write to a completely different set of pins, but some ports are connected to more than eight pins, and some connected to fewer. You'd have to change those pinMode statements to the correct pins, and change the places where GPIO registers are set from GPIOD to whatever GPIO port you want to use instead. You'll want to look at the schematic (https://www.pjrc.com/teensy/schematic.html) to see which pins are connected to which ports.
 
Thanks, Mark! FastLED looks very cool, thought pretty overbuilt for my needs. Anyway, guess its time to say goodbye to OctoWS.
 
Thanks, Mark! FastLED looks very cool, thought pretty overbuilt for my needs. Anyway, guess its time to say goodbye to OctoWS.

Yeah, I'm a fan of simplicity! If you do want to try to get OctoWS2811 working on a different port, I can try to help you out. It doesn't look like it should be that hard. But I do not have a Teensy 3.x to test with.
 
Really appreciate the offer, Mark, but I already bit the bullet and redid all my logic with FastLED. Works fine and frees up a dozen ports, which is nice.
Again, thanks for the help. Happy to finance your 3.2, if you take PayPal :)
 
Switching to a different port shouldn't be too difficult. Change the pinMode lines, and the 3 DMA destination addresses.
 
Really appreciate the offer, Mark, but I already bit the bullet and redid all my logic with FastLED. Works fine and frees up a dozen ports, which is nice.
Again, thanks for the help. Happy to finance your 3.2, if you take PayPal :)

No worries. I'm having fun trying to eek as much out of my Teensy LC as it will give!
 
Status
Not open for further replies.
Back
Top