Page 1 of 1

Problem with the WS2812B component in PIC32MX370F512H MCU

Posted: Tue Mar 16, 2021 8:49 pm
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" .)

Re: Problem with the WS2812B component in PIC32MX370F512H MCU

Posted: Tue Mar 16, 2021 10:22 pm
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.

Re: Problem with the WS2812B component in PIC32MX370F512H MCU

Posted: Wed Mar 17, 2021 12:21 am
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 187 times
and the LED row.
PIC32MX370_WS2812B_test.fcfx
(10.61 KiB) Downloaded 186 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. :)

Re: Problem with the WS2812B component in PIC32MX370F512H MCU

Posted: Thu Mar 18, 2021 2:34 pm
by Lagoda
Hi Ben,

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

Lagoda

Re: Problem with the WS2812B component in PIC32MX370F512H MCU

Posted: Fri Mar 19, 2021 10:34 am
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.

Re: Problem with the WS2812B component in PIC32MX370F512H MCU

Posted: Fri Mar 19, 2021 4:02 pm
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 9100 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:

Re: Problem with the WS2812B component in PIC32MX370F512H MCU

Posted: Mon Mar 22, 2021 5:49 pm
by Lagoda
Hello Ben,

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

Lagoda

Re: Problem with the WS2812B component in PIC32MX370F512H MCU

Posted: Tue Mar 23, 2021 12:03 pm
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?

Re: Problem with the WS2812B component in PIC32MX370F512H MCU

Posted: Tue Mar 23, 2021 2:17 pm
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

Re: Problem with the WS2812B component in PIC32MX370F512H MCU

Posted: Tue Mar 23, 2021 9:30 pm
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?

Re: Problem with the WS2812B component in PIC32MX370F512H MCU

Posted: Wed Mar 24, 2021 3:45 pm
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 179 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>

Re: Problem with the WS2812B component in PIC32MX370F512H MCU

Posted: Thu Apr 01, 2021 1:18 pm
by Lagoda
Happy Easter! :) :(

Re: Problem with the WS2812B component in PIC32MX370F512H MCU

Posted: Tue Apr 27, 2021 10:00 am
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

Re: Problem with the WS2812B component in PIC32MX370F512H MCU

Posted: Tue Apr 27, 2021 11:47 am
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.

Re: Problem with the WS2812B component in PIC32MX370F512H MCU

Posted: Tue Apr 27, 2021 7:17 pm
by Lagoda
:)