Problem with the WS2812B component in PIC32MX370F512H MCU
Moderator: Benj
-
- Posts: 170
- Joined: Fri Jul 15, 2016 9:51 pm
- Has thanked: 69 times
- Been thanked: 61 times
- Contact:
Problem with the WS2812B component in PIC32MX370F512H MCU
Hi Ben,
Unfortunately this component not working correctly.
The timing of the bits does not appear to be correct.
When I try to change the bit timing in custom mode, I can't set T1L and T0L shorter than 2us. (tested with oscilloscope)
The system clock is 98.304 MHz.The periferial clock is same.
If I set the default timings of WS2812B, then I measured the followig values: T1H=1.56us, T1L=2.12us, T0H=1.16us, T0L=2.46us ( I measured it more then once )
Do you have any idea?
Regards,
Lagoda
ps:
It can help to solve the problem that the delay component is not accurate in the millisecond range either. If I set 1 ms, the actual measured 500us.
(I have same problem in the range of "us" and range of "s" .)
Unfortunately this component not working correctly.
The timing of the bits does not appear to be correct.
When I try to change the bit timing in custom mode, I can't set T1L and T0L shorter than 2us. (tested with oscilloscope)
The system clock is 98.304 MHz.The periferial clock is same.
If I set the default timings of WS2812B, then I measured the followig values: T1H=1.56us, T1L=2.12us, T0H=1.16us, T0L=2.46us ( I measured it more then once )
Do you have any idea?
Regards,
Lagoda
ps:
It can help to solve the problem that the delay component is not accurate in the millisecond range either. If I set 1 ms, the actual measured 500us.
(I have same problem in the range of "us" and range of "s" .)
Last edited by Lagoda on Tue Mar 16, 2021 10:53 pm, 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: Problem with the WS2812B component in PIC32MX370F512H MCU
Hi Lagoda,
Do you have any high speed interrupts running that could be causing timing issues? Interesting the delays are out, these should be fairly tight.
What is your T0H timing currently set to? This is the one you need to bring down if possible, the other all look to be in tolerance.
Can you post your program just in case I spot anything there.
Do you have any high speed interrupts running that could be causing timing issues? Interesting the delays are out, these should be fairly tight.
What is your T0H timing currently set to? This is the one you need to bring down if possible, the other all look to be in tolerance.
Can you post your program just in case I spot anything there.
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
-
- Posts: 170
- Joined: Fri Jul 15, 2016 9:51 pm
- Has thanked: 69 times
- Been thanked: 61 times
- Contact:
Re: Problem with the WS2812B component in PIC32MX370F512H MCU
Hello Ben,
I am not using the interrupt currently. But I want to use it later.
I attach two simple test programs with which I tested the Delay and Interrupt and the LED row. In the first program, the interrupt timing is correct 2 ms, but the delay is only 500us instead of 1ms.
Thank you for your quick response.
I am not using the interrupt currently. But I want to use it later.
I attach two simple test programs with which I tested the Delay and Interrupt and the LED row. In the first program, the interrupt timing is correct 2 ms, but the delay is only 500us instead of 1ms.
Thank you for your quick response.
-
- Posts: 170
- Joined: Fri Jul 15, 2016 9:51 pm
- Has thanked: 69 times
- Been thanked: 61 times
- Contact:
Re: Problem with the WS2812B component in PIC32MX370F512H MCU
Hi Ben,
How can I help make this component work as soon as possible?
Lagoda
How can I help make this component work as soon as possible?
Lagoda
- 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: Problem with the WS2812B component in PIC32MX370F512H MCU
Hi Lagoda,
Thanks for the files.
How about changing the LED type property to custom and then reducing the T0H timing, maybe to 0.1 and see how that works.
I'll investigate the delays being wrong here on the hardware I have available.
Thanks for the files.
How about changing the LED type property to custom and then reducing the T0H timing, maybe to 0.1 and see how that works.
I'll investigate the delays being wrong here on the hardware I have available.
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
-
- Posts: 170
- Joined: Fri Jul 15, 2016 9:51 pm
- Has thanked: 69 times
- Been thanked: 61 times
- Contact:
Re: Problem with the WS2812B component in PIC32MX370F512H MCU
Hi Ben,
I tried what you asked for. In custom mode, I set the following values and then programmed the MCU: I measured the following values:T0H=1.14us, T0L=2.44us, T1H=1.55us, T1L=2.11us
These measured results do not differ from the values measured with the WS2812B setting.
I tried what you asked for. In custom mode, I set the following values and then programmed the MCU: I measured the following values:T0H=1.14us, T0L=2.44us, T1H=1.55us, T1L=2.11us
These measured results do not differ from the values measured with the WS2812B setting.
-
- Posts: 170
- Joined: Fri Jul 15, 2016 9:51 pm
- Has thanked: 69 times
- Been thanked: 61 times
- Contact:
Re: Problem with the WS2812B component in PIC32MX370F512H MCU
Hello Ben,
I would like to know when you can fix it?
Lagoda
I would like to know when you can fix it?
Lagoda
- 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: Problem with the WS2812B component in PIC32MX370F512H MCU
Hi Lagoda,
As your delays are off that indicates things aren't setup correctly and the MCU likely isn't running at the speed you think it is.
The first thing to focus on is getting the delays correct. Some advice here on testing and things to investigate.
https://www.matrixtsl.com/wiki/index.ph ... ED_flasher
The bacground debugger config option seems to have an invalid option in the config settings.
What crystal frequency are you using?
As your delays are off that indicates things aren't setup correctly and the MCU likely isn't running at the speed you think it is.
The first thing to focus on is getting the delays correct. Some advice here on testing and things to investigate.
https://www.matrixtsl.com/wiki/index.ph ... ED_flasher
The bacground debugger config option seems to have an invalid option in the config settings.
What crystal frequency are you using?
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
-
- Posts: 170
- Joined: Fri Jul 15, 2016 9:51 pm
- Has thanked: 69 times
- Been thanked: 61 times
- Contact:
Re: Problem with the WS2812B component in PIC32MX370F512H MCU
Hi Ben,
I tried other setups of Bacground Debugger, but the original problem is same as before.
Earlier I mentioned:
I did not mentioned earlier, but UARTs working correctly for example.
Lagoda
Yes, this is the default setup of Bacground Debugger in Flowcode for PIC32MX370F512H MCU.The bacground debugger config option seems to have an invalid option in the config settings.
I tried other setups of Bacground Debugger, but the original problem is same as before.
I am using 4.9152 MHz MEMS oscillator.What crystal frequency are you using?
Earlier I mentioned:
The system clock is 98.304 MHz.The periferial clock is same.
In my opinion if the interrupt timings is correct then the systemclock is OK.PIC32MX370_Delay_Test.fcfx
(9.86 KiB) Downloaded 3 times
In the first program, the interrupt timing is correct 2 ms, but the delay is only 500us instead of 1ms.
I did not mentioned earlier, but UARTs working correctly for example.
Lagoda
- 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: Problem with the WS2812B component in PIC32MX370F512H MCU
Hi Lagoda,
I'm doing some more investigation for you now. I may end up buying one of the ICs so I can test here.
Are you programming the IC directly with say a PICkit or do you have a bootloader loaded on the IC? Just wondering if we can trust the config values being assigned by Flowcode.
It might also be worth a sanity check to try halfing the speed in the project options and see if the 1s delays start being calculated correctly. Then maybe try changing PBCLK to be SYSCLK / 2 and see if that makes baud rates come good again.
Looking again is your POSCMOD config setting correct?
I'm doing some more investigation for you now. I may end up buying one of the ICs so I can test here.
Are you programming the IC directly with say a PICkit or do you have a bootloader loaded on the IC? Just wondering if we can trust the config values being assigned by Flowcode.
It might also be worth a sanity check to try halfing the speed in the project options and see if the 1s delays start being calculated correctly. Then maybe try changing PBCLK to be SYSCLK / 2 and see if that makes baud rates come good again.
Looking again is your POSCMOD config setting correct?
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
-
- Posts: 170
- Joined: Fri Jul 15, 2016 9:51 pm
- Has thanked: 69 times
- Been thanked: 61 times
- Contact:
Re: Problem with the WS2812B component in PIC32MX370F512H MCU
Hi Ben,
I used the following program for testing: Lagoda
ps:
If I manually changed the value of the variable "MX_CLKS_PER_INST" to 2, this bundled program will work properly.
Maybe the mistake is somewhere here?
Yes, I checked it in with MPLAB X IDE.Looking again is your POSCMOD config setting correct?
I halved the clock in the project option window (49.152000 MHz) and then halved the delay (now 250us it was 500us). The timing of the interrupt has not changed.It might also be worth a sanity check to try halfing the speed in the project options and see if the 1s delays start being calculated correctly.
When I changed the PBCLK to SYSCLK / 2, the interrupt timing changed to 4 ms, which was 2 ms. The timing of the Delay has not changed.Then maybe try changing PBCLK to be SYSCLK / 2 and see if that makes baud rates come good again.
I am using ICD3 for programming.Are you programming the IC directly with say a PICkit or do you have a bootloader loaded on the IC?
I used the following program for testing: Lagoda
ps:
If I manually changed the value of the variable "MX_CLKS_PER_INST" to 2, this bundled program will work properly.
Maybe the mistake is somewhere here?
#define MX_PIC32
#define MX_CAL_PIC32
#define MX_CLK_SPEED 98304000
#define FCP_NULL Unconnected_Port
#define MX_CLKS_PER_INST 4
#define MX_SPI1CON
#define MX_PIC32
#define MX_CAL_PIC32
#include <xc.h>
-
- Posts: 170
- Joined: Fri Jul 15, 2016 9:51 pm
- Has thanked: 69 times
- Been thanked: 61 times
- Contact:
Re: Problem with the WS2812B component in PIC32MX370F512H MCU
Hello Everyone,
I think this topic is dead.
There seems to be no solution.
The Product Support is currently focused on Flowcode 9.
I would like to note that the WS2812 component macro in Flowcode 9 does not work with this MCU either.
In the meantime, I managed to control the LED strip without using the WS2812 macro.
Not a professional solution, but it works.
If anyone is interested, I found a description of the true limits of WS2812 bit timings. (Thanks to Tim for his work.)
https://cpldcpu.wordpress.com/2014/01/1 ... he-ws2812/
Regards,
Lagoda
I think this topic is dead.
There seems to be no solution.
The Product Support is currently focused on Flowcode 9.
I would like to note that the WS2812 component macro in Flowcode 9 does not work with this MCU either.
In the meantime, I managed to control the LED strip without using the WS2812 macro.
Not a professional solution, but it works.
If anyone is interested, I found a description of the true limits of WS2812 bit timings. (Thanks to Tim for his work.)
https://cpldcpu.wordpress.com/2014/01/1 ... he-ws2812/
Regards,
Lagoda
- Steve
- Matrix Staff
- Posts: 3424
- Joined: Tue Jan 03, 2006 3:59 pm
- Has thanked: 114 times
- Been thanked: 422 times
- Contact:
Re: Problem with the WS2812B component in PIC32MX370F512H MCU
Hi Lagoda,
Sorry that you haven't had a reply for a while. Sometimes posts get missed or forgotten about (on this and the new forum) as everyone is always busy, and I think this has happened to you here.
We're still actively supporting v8 and so if you feel we've forgotten about an issue then please bump the topic as a reminder that the issue has not been resolved.
Regards,
Steve.
Sorry that you haven't had a reply for a while. Sometimes posts get missed or forgotten about (on this and the new forum) as everyone is always busy, and I think this has happened to you here.
We're still actively supporting v8 and so if you feel we've forgotten about an issue then please bump the topic as a reminder that the issue has not been resolved.
Regards,
Steve.