Hi
After some hard time investigating what is wrong I found that the Servo controller is conflicting with the WS2812 Component
If i Initialize the servo controller before the WS2812 Macro , Ws2812 will not work properly.
If i remove the initialize servo controller than all works OK , maybe there are same variables with same name or something
I made i very simple program where the conflict happens .
Conflicting Conponents ( Solved )
Moderator: Benj
- Alan_37
- Posts: 179
- Joined: Sun May 01, 2016 8:36 pm
- Has thanked: 51 times
- Been thanked: 54 times
- Contact:
Conflicting Conponents ( Solved )
- Attachments
-
- Flowcode1.fcfx
- (16.28 KiB) Downloaded 233 times
Last edited by Alan_37 on Wed Jan 25, 2017 11:13 am, edited 1 time in total.
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Conflicting Conponents
Hi Alan,
The servo component uses interrupts to bit bang out the servo motor signals. The WS2812 component uses very tight timings to bit bang out the LED signals.
If the servo interrupt kicks in during the WS2812 refresh then it will completely destroy the LED control timings.
You could disable interrupts before calling the refresh function and re-enable them again afterwards and that should help things.
To disable interrupts on your ATMEGA2560 use the following code in a C icon.
Then to re-enable the interrupts again.
Let us know how you get on.
The servo component uses interrupts to bit bang out the servo motor signals. The WS2812 component uses very tight timings to bit bang out the LED signals.
If the servo interrupt kicks in during the WS2812 refresh then it will completely destroy the LED control timings.
You could disable interrupts before calling the refresh function and re-enable them again afterwards and that should help things.
To disable interrupts on your ATMEGA2560 use the following code in a C icon.
Code: Select all
cli();
Code: Select all
sei();
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
- Alan_37
- Posts: 179
- Joined: Sun May 01, 2016 8:36 pm
- Has thanked: 51 times
- Been thanked: 54 times
- Contact:
Re: Conflicting Conponents
Hi Benj
Yes Confirmed , that was the problem and the C-code works 100% .
Just another couple of questions
Is there any other components that you remember with the same issue ?
The C-Code provided works only on Arduino 2560 ?
Thanks very much for your fast Support
Yes Confirmed , that was the problem and the C-code works 100% .
Just another couple of questions
Is there any other components that you remember with the same issue ?
The C-Code provided works only on Arduino 2560 ?
Thanks very much for your fast Support
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Conflicting Conponents ( Solved )
Hi Alan,
Interrupts will effect any component that has critical timings for example a software UART would have similar problems though a hardware UART would not. Software I2C and Software SPI don't have the same problem as they rely on a clock to drive the data rather than a timing critical baud rate.
We try and allow things to work together as best as possible but if you're unsure about the consequences of a specific combination then you can always ask.
The C code should work for any AVR device. For a PIC (8/16 bit) the code might look like this.
Disable Interrupts
Enable Interrupts
Interrupts will effect any component that has critical timings for example a software UART would have similar problems though a hardware UART would not. Software I2C and Software SPI don't have the same problem as they rely on a clock to drive the data rather than a timing critical baud rate.
We try and allow things to work together as best as possible but if you're unsure about the consequences of a specific combination then you can always ask.
The C code should work for any AVR device. For a PIC (8/16 bit) the code might look like this.
Disable Interrupts
Code: Select all
INTCONbits.GIE = 0;
Code: Select all
INTCONbits.GIE = 1;
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
- Alan_37
- Posts: 179
- Joined: Sun May 01, 2016 8:36 pm
- Has thanked: 51 times
- Been thanked: 54 times
- Contact:
Re: Conflicting Conponents ( Solved )
Hi Ben
That is very interesting and good to know , my intention is port the project to the STM 32bit ARM Processors
when the update is out and peripherals supported .
Ok then thanks again .
Regards
That is very interesting and good to know , my intention is port the project to the STM 32bit ARM Processors
when the update is out and peripherals supported .
Ok then thanks again .
Regards