the tpm2net code recieves a packet of data ... it then send that packet of data to the ws2812 code ... where it disables the iterrupts ... loops through the packet bitbanging the gpio until complete ... the interrupts are re-enabled ... control is returned to the tpm2net code to receive the next packet ... hoping that a large enough delay doesn't happen to cause a reset (end of frame) ... this method would certainly fail ... because the timing could not be guaranteed for the full frame ...
the only reason we are disabling the interrupts, is to prevent our timing (blocking while loops) from getting skewed ...
1)we still don't know if this code is the problem ... or the host software (and if it is this code)
2)we still don't know if the interrupt blocking is a problem ... or if a drift in the timing over 512 pixels is emerging ...
Here's part of the assembly code for the ws2812.c file ... anyone want to see if they can refine/improve things here ...
.literal_position
.literal .LC0, 1610613504
.align 4
.global SEND_WS_0
.type SEND_WS_0, @function
SEND_WS_0:
l32r a3, .LC0
movi.n a2, 1
memw
s32i.n a2, a3, 0
memw
s32i.n a2, a3, 0
memw
s32i.n a2, a3, 0
memw
s32i.n a2, a3, 0
movi.n a4, 0
movi.n a2, 9
.L3:
addi.n a2, a2, -1
memw
s32i.n a4, a3, 0
extui a2, a2, 0, 8
bnez.n a2, .L3
ret.n
.size SEND_WS_0, .-SEND_WS_0
.literal_position
.literal .LC1, 1610613504
.align 4
.global SEND_WS_1
.type SEND_WS_1, @function
SEND_WS_1:
l32r a3, .LC1
movi.n a2, 8
movi.n a4, 1
.L7:
addi.n a2, a2, -1
memw
s32i.n a4, a3, 0
extui a2, a2, 0, 8
bnez.n a2, .L7
memw
s32i.n a2, a3, 0
memw
s32i.n a2, a3, 0
memw
s32i.n a2, a3, 0
memw
s32i.n a2, a3, 0
memw
s32i.n a2, a3, 0
memw
s32i.n a2, a3, 0
ret.n
.size SEND_WS_1, .-SEND_WS_1
.literal_position
.literal .LC4, 1610613504
.align 4
.global ws2812_out
.type ws2812_out, @function
ws2812_out:
addi sp, sp, -16
movi.n a5, 0
s32i.n a12, sp, 8
extui a12, a3, 0, 16
movi.n a3, 1
s32i.n a13, sp, 4
mov.n a4, a3
mov.n a13, a2
mov.n a2, a5
s32i.n a0, sp, 12
call0 gpio_output_set
call0 ets_intr_lock
bnez.n a12, .L9
.L19:
call0 ets_intr_unlock
l32i.n a0, sp, 12
l32i.n a12, sp, 8
l32i.n a13, sp, 4
addi sp, sp, 16
ret.n
.L9:
addi.n a3, a12, -1
addi.n a10, a13, 1
extui a3, a3, 0, 16
l32r a4, .LC4
mov.n a2, a13
add.n a10, a10, a3
movi.n a5, 1
movi.n a6, 0
.L20:
l8ui a9, a2, 0
movi.n a8, 8
movi a7, 0x80
.L18:
bany a7, a9, .L10
memw
s32i.n a5, a4, 0
memw
s32i.n a5, a4, 0
memw
s32i.n a5, a4, 0
memw
s32i.n a5, a4, 0
movi.n a3, 9
j .L11
.L10:
movi.n a3, 8
.L13:
addi.n a3, a3, -1
memw
s32i.n a5, a4, 0
extui a3, a3, 0, 8
bnez.n a3, .L13
memw
s32i.n a3, a4, 0
memw
s32i.n a3, a4, 0
memw
s32i.n a3, a4, 0
memw
s32i.n a3, a4, 0
memw
s32i.n a3, a4, 0
memw
s32i.n a3, a4, 0
.L17:
addi.n a8, a8, -1
srli a7, a7, 1
bnez.n a8, .L18
j .L23
.L11:
addi.n a3, a3, -1
memw
s32i.n a6, a4, 0
extui a3, a3, 0, 8
bnez.n a3, .L11
j .L17
.L23:
addi.n a2, a2, 1
bne a2, a10, .L20
j .L19
.size ws2812_out, .-ws2812_out
.literal_position
.align 4
.global ws2812_init
.type ws2812_init, @function
ws2812_init:
addi sp, sp, -32
s32i.n a0, sp, 28
call0 ets_wdt_disable
movi.n a4, 0
mov.n a2, sp
movi.n a3, 3
s8i a4, sp, 0
s8i a4, sp, 1
s8i a4, sp, 2
call0 ws2812_out
l32i.n a0, sp, 28
addi sp, sp, 32
ret.n
.size ws2812_init, .-ws2812_init