RGB lightsaber

What are you developing?
User avatar
RogerClark
Posts: 7157
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: RGB lightsaber

Post by RogerClark » Sat Jun 10, 2017 8:44 pm

Are you using SPI at DIV32, with 3 SPI bits per pulse ?

In theory the timing should be within spec, as each bit sent via SPI is 444nS long, and the shortest bit duration can be 250nS to 550nS

On the 100MHz logic analyser, I'm seeing variation of pulse width of 10nS, but that is just going to be the sample resolution of the analyser.
But the very first "bit" of data sent by SPI always seems longer, at around 490uS, which was the cause of the Green LED turning on.

Sending a first byte containing 0x00 fixed this.

BTW. Thanks for the link. Very interesting.
Basically, its only the length of the High pulse that is critical, and determines whether the "pixel bit" is 1 or 0.
i.e the LEDs are not comparing the mark/space ratio to determine if its a mark or a space.

This explains why the bit banged implementation seems to work ok, even though the length of the Low part of the bits is not super accurate.

Also the reason only the first pixel seems to be problematic, is according to the article , that the first pixel is cleaning the data and resending it.

BTW.
I see the Teensy can DMA 8 strings of LEDs at once, so I wonder how this is being achieved. I presume its using a similar principal, but DMAing to GPIO, 1 byte wide. But the Teens code seems to be part of the Teensy installed suite and mot available elsewhere eg. github.

I may look for an ESP8266 or Arduino Due etc implementation and see how they do it

User avatar
RogerClark
Posts: 7157
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: RGB lightsaber

Post by RogerClark » Sat Jun 10, 2017 9:34 pm

I found this

http://www.martinhubacek.cz/arm/improve ... 2b-library

It seems to be able to DMA multiple strips via DMA.

It may be compatible with one of the HAL based cores.

But for a single string I think that the size of the data would be unnessecarily large

I think I may start a new thread for this subject on its own

User avatar
RogerClark
Posts: 7157
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: RGB lightsaber

Post by RogerClark » Sun Jun 11, 2017 5:49 am

I made my code into a library, that mostly supports the Adafruit API

viewtopic.php?f=13&t=2179

I've also been messing around with doing asynchronous dmaTransfers to improve the speed, and I've added a new function to SPI called dmaSendAsync

This function is not used in the library, but what it does is start the dmaTransfer then exit the function, so that the main code can carry on and do other things.

Then when you call dmaSendAsync, it checks if the transfer is still in process, in which case it waits for it to finish before setting up a new transfer

However I'd need to use double buffering in the library to support this, - which I've not written yet.

racemaniac
Posts: 554
Joined: Sat Nov 07, 2015 9:09 am

Re: RGB lightsaber

Post by racemaniac » Sun Jun 11, 2017 7:10 am

nice :D
and the other link you sent with the timers & multiple dma's is insane XD. i've yet to learn how to use such features (although i've recently for the first time done dma triggered by a timer for adc sampling, but it was a frustrating exercise).
And as you can see in my code, i'm using the fact that the low signal can be a bit longer to use 4 bits per signal in my SPI generator, and i can then simply convert a byte i want to send to the string to an 32bit int via a small lookup table (1kb in size), and then you can very quickly convert a framebuffer containing rgb values to a buffer containing the neopixel signal :).

User avatar
RogerClark
Posts: 7157
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: RGB lightsaber

Post by RogerClark » Sun Jun 11, 2017 8:06 am

OK.
I use LUTs to work out the values needed for my 3 bits per bit system

I could make the LUTs smaller, and I left the small LUTs in the code, but it would run slower as I'd need to do masking and shifting, and it would take longer to send, so 3 bits works OK for me

racemaniac
Posts: 554
Joined: Sat Nov 07, 2015 9:09 am

Re: RGB lightsaber

Post by racemaniac » Tue Jul 18, 2017 1:26 pm

Time for another small update:

I've recently received some great solder paste (loctite GC-10), and it's working really well :). Been improving the stencils for soldering SMD i make a bit (for the MPU6050 it gave me too much paste, giving shorts when soldering), and i'm now getting pretty decent results when populating & reflowing the pcb's (atm still reflowing the pcb's in a skillet. looking into building an own oven, but the skillet method is also working pretty well :D)
pcbs.jpg
pcbs.jpg (112.3 KiB) Viewed 245 times
Now step by step testing these boards :).
So far the stm32 can be programmed, the crystal is working & the mpu6050 is also working :).
Now onto the mosfets that are shutting down the other parts of the board (dac, sdcard & amplifier), and see what this board is capable of :)

racemaniac
Posts: 554
Joined: Sat Nov 07, 2015 9:09 am

Re: RGB lightsaber

Post by racemaniac » Thu Aug 17, 2017 6:05 am

Another small update: tested everything except the USB so far on the above boards, and it's all good XD

Was struggling with the sd cards a bit, but it ended up actually being an sd card that was broken ^^'. (i'll have to keep an eye on it if i break any more sd cards while using these board :) ).
but pretty happy these little guys are working XD.

User avatar
RogerClark
Posts: 7157
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: RGB lightsaber

Post by RogerClark » Thu Aug 17, 2017 6:50 am

Nice work !

outgoingbot
Posts: 4
Joined: Wed Sep 06, 2017 9:31 pm

Re: RGB lightsaber

Post by outgoingbot » Thu Sep 07, 2017 9:57 pm

racemaniac wrote:
Thu Aug 17, 2017 6:05 am
Another small update: tested everything except the USB so far on the above boards, and it's all good XD

Was struggling with the sd cards a bit, but it ended up actually being an sd card that was broken ^^'. (i'll have to keep an eye on it if i break any more sd cards while using these board :) ).
but pretty happy these little guys are working XD.
I would love to build one of these. do you plan on releasing the source code/schematics?

zmemw16
Posts: 1449
Joined: Wed Jul 08, 2015 2:09 pm
Location: St Annes, Lancs,UK

Re: RGB lightsaber

Post by zmemw16 » Fri Sep 08, 2017 12:18 am

@racemaniac
any chance of a video ?
set of nice photo's ?
stephen

Post Reply