Problem with the WS2812B component in PIC32MX370F512H MCU

Moderator: Benj

Post Reply
Lagoda
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

Post by Lagoda »

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" .)
Last edited by Lagoda on Tue Mar 16, 2021 10:53 pm, edited 1 time in total.

User avatar
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

Post by Benj »

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.

Lagoda
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

Post by Lagoda »

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
PIC32MX370_Delay_Test.fcfx
(9.86 KiB) Downloaded 156 times
and the LED row.
PIC32MX370_WS2812B_test.fcfx
(10.61 KiB) Downloaded 162 times
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. :)

Lagoda
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

Post by Lagoda »

Hi Ben,

How can I help make this component work as soon as possible?

Lagoda

User avatar
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

Post by Benj »

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.

Lagoda
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

Post by Lagoda »

Hi Ben,

I tried what you asked for. In custom mode, I set the following values and then programmed the MCU:
LED_WS2811_Custom.png
LED_WS2811_Custom.png (24.5 KiB) Viewed 6949 times
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. :roll:

Lagoda
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

Post by Lagoda »

Hello Ben,

I would like to know when you can fix it? :|

Lagoda

User avatar
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

Post by Benj »

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?

Lagoda
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

Post by Lagoda »

Hi Ben,
The bacground debugger config option seems to have an invalid option in the config settings.
Yes, this is the default setup of Bacground Debugger in Flowcode for PIC32MX370F512H MCU.
I tried other setups of Bacground Debugger, but the original problem is same as before.
What crystal frequency are you using?
I am using 4.9152 MHz MEMS oscillator.
Earlier I mentioned:
The system clock is 98.304 MHz.The periferial clock is same.
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.
In my opinion if the interrupt timings is correct then the systemclock is OK.
I did not mentioned earlier, but UARTs working correctly for example.

Lagoda

User avatar
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

Post by Benj »

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?

Lagoda
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

Post by Lagoda »

Hi Ben,
Looking again is your POSCMOD config setting correct?
Yes, I checked it in with MPLAB X IDE.
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.
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.
Then maybe try changing PBCLK to be SYSCLK / 2 and see if that makes baud rates come good again.
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.
Are you programming the IC directly with say a PICkit or do you have a bootloader loaded on the IC?
I am using ICD3 for programming.


I used the following program for testing:
PIC32MX370_Delay_Test.fcfx
(9.86 KiB) Downloaded 150 times
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>

Lagoda
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

Post by Lagoda »

Happy Easter! :) :(

Lagoda
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

Post by Lagoda »

Hello Everyone,

I think this topic is dead. :cry:
There seems to be no solution. :roll:
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

User avatar
Steve
Matrix Staff
Posts: 3418
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

Post by Steve »

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.

Lagoda
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

Post by Lagoda »

:)

Post Reply