Bleep Guru
 Joined: 09/01/2022 Location: United KingdomPosts: 611 |
Posted: 06:08pm 07 Jan 2023 |
|
|
|
Hi Peter, Thanks very much for this release, working fine, except for one problem I'm having. This is on a VGA. If you load my WS2812 PIO program below.
'PIO WS2812 driver on GP0 ' ' The PIO program -------------------------------------------------------------
'Set GPIO to GP0, PIO no. 1 SetPin gp0,pio1
'configure the PIO sequencer clock and pin registers e0=Pio(execctrl GP0,1,4) p0=Pio(pinctrl 1,1,,,gp0,gp0,) 'GP0 side set, GP0 SET (for pindirs) f0=Pio(shiftctrl 0,0,0,1) 'Set Auto Pull at 32bits (0) fr0=5000000 '5MHz PIO frequency, lowest I could go with my pixels
'This code relies on AutoPull when all 32 bits have been read from X 'line Bin code comment '0 1110 0000 1000 0001 'set GP0 output, side(0), 'note GP0 is assigned in pinctrl '.wrap_target '1 0110 0002 0010 0001 'out x, 1bit, side(0), dly 1 or 2 or 1 'put one bit in x side set 0 '2 0001 0001 0010 0011 'jmp !x to 4, side(1), dly 1 or 1 or 1 'jump if not X (ie 0) side set 1 '3 0001 0004 0000 0000 'jmp to 1, side(1), dly 1 or 1 or 2 'jump to 1 side set 1 '4 1010 0004 0100 0010 'MOV Y to Y side(0), dly 1 or 2 or 2 'Nop delay side set 0 'wrap PIO program line 1,0,&hEF81 PIO program line 1,1,&h6121 PIO program line 1,2,&h1124 PIO program line 1,3,&h1101 PIO program line 1,4,&hA142
'PIO1.0 setup the machine. PIO init machine 1,0,fr0,p0,e0,f0,0 'LED data GRBG RBGR BGRB GRBG Dim Integer ct(3)=(&h00000100,&h00010000,&h01000001,&h00000100) 'The MMBasic program --------------------------------------------------------
Do PIO start 1,0 'start the PIO For b=0 To 86 PIO WRITE 1,0,3,ct(0),ct(1),ct(2) 'writes led colours to fifo Next PIO Write 1,0,1,&h00000000 ' Haven't worked out why I need this to flush? ct(3)=ct(0):ct(0)=ct(1):ct(1)=ct(2):ct(2)=ct(3) ' rotate the colours PIO stop 1,0 'stop the pio Pause 200 Loop While Inkey$="" End and run it, all works fine. If I Ctrl C out and run again I get various errors, like:- [9] e0=Pio(execctrl GP0,1,4) Error : Divide by zero or [9] e0=Pio(execctrl GP0,1,4) Error : 3 is invalid (valid is 0 to 1) If I edit the code and make any change, even a comment and re-run all is fine again for the first run, then errors after that. If I 'List' my program and then try to 'run' it I get:- Error: Invalid address - resetting my options are:- PicoMiteVGA MMBasic Version 5.07.06 OPTION SYSTEM I2C GP22,GP15 OPTION COLOURCODE ON OPTION KEYBOARD UK OPTION CPUSPEED (KHz) 378000 OPTION DEFAULT MODE 2 OPTION SDCARD GP5, GP2, GP3, GP4 OPTION AUDIO GP6,GP7, ON PWM CHANNEL 3 OPTION RTC AUTO ENABLE OPTION F6 Edit 1 OPTION F7 Edit 2 OPTION DEFAULT FONT 8, 1 Thanks for any help. Regards, Kevin. Edited 2023-01-08 04:17 by Bleep |