![]() |
Forum Index : Microcontroller and PC projects : PicoMite V6.00.02 betas
![]() ![]() ![]() ![]() |
|||||
Author | Message | ||||
PhenixRising Guru ![]() Joined: 07/11/2023 Location: United KingdomPosts: 1092 |
Great news ![]() |
||||
ville56 Senior Member ![]() Joined: 08/06/2022 Location: AustriaPosts: 188 |
@javavi: where did you hide the pullup resistor for the PSRAM CS pin or don't you use one? Your setup is really neat ... 73 de OE1HGA, Gerald |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 9810 |
Question for Harm I think there is a small hole in PIO support unless you can tell me otherwise. As an example, say I want a simple SPI transmit module with the clock on GP2 and the data on GP7. I will obviously use SIDESET for the clock and OUT for the data. However, unless I'm missing something there is no way to set the OUT pin as an output. I note in some of your examples you use pinctrl to set the number of SET pins even though you aren't using SET but only SIDESET or OUT. In your code you then use SET PINDIRS to make the relevant pins outputs. This works if the SIDESET and OUT pins are the same or contiguous but I can't see how it can work for my example. In the sdk there is a command sm_config_set_out_pins which is used to set the relevant pins as outputs. Either I need to expose this command to Basic, or I need to automatically create and execute it based on the values in PINCTRL Thoughts? One more thing. Currently, MMBasic doesn't support using pins GP30-GP47 on the RP2350B as PIO pins. The way this works in the sdk is VERY clunky. You call a command to rebase all PIO pins from GP16. Then when you reference GP0 in a PIO statement you are actually using GP16 and GP29 is GP47. I could add this rebase command (I'm not sure if it applies at the PIO or SM level) to MMBasic but how we document it...... |
||||
javavi![]() Guru ![]() Joined: 01/10/2023 Location: UkrainePosts: 402 |
@ville56: There in the photo you can see, the 10k SMD pull-up resistor is soldered to the left edge from 1 to 8 legs of the PSRAM chip (from the side of the yellow jumper). "Pico2" with PSRAM photo I use GP8 as a chip selection signal for PSRAM, initially I just soldered a straight wire there and it worked like that too. But then I wanted to put a jumper so that I could turn off and on the use of PSRAM in this "Pico2" for different projects. And in order to be able to turn off the use of the soldered PSRAM with a jumper, this pull-up resistor is needed. Edited 2025-01-19 19:16 by javavi |
||||
Volhout Guru ![]() Joined: 05/03/2018 Location: NetherlandsPosts: 4723 |
@Peter, In one of my other projects I used a whole statemachine, just to set such pin as output. It does not matter which statemacine sets the output. I read about the rebase issue, but sine I did not have a RP2350B yet, have not played with it. Harm P.s. don’t use pinctrl to set datadirection. That may affect programs that use pindirs in mnemonics. Edited 2025-01-19 20:47 by Volhout PicomiteVGA PETSCII ROBOTS |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 9810 |
Harm Later today I'll post a new version which will automatically set all pins specified in PINCTRL as sideset, output, or set, as outputs. Then you will be able to flexibly use the pins much more easily. The SET PINDIRS commands in programs will then become redundant UNLESS you want to switch a SET pin to an input. For programs that just use SIDESET and OUT, you will be able to remove the SET pins from PINCTRL although leaving them there will be benign |
||||
Volhout Guru ![]() Joined: 05/03/2018 Location: NetherlandsPosts: 4723 |
Hi Peter, I see benefit in your idea of forcing pins to output defined in PINCTRL. But... As the last line of the previous post. PIO expect the "option" function in side set to be added into the PINCTRL (see the "2" in PIO(PINCTRL ) in the UART TX program. You only want GP0 output, and an extra enable/option bit. But you do not want GP1 output, since that is your input.. Similar you can shift OUT data towards the pindirs, basically creating open drain outputs. (like in the PIO I2C example). I do not think it is wise to force pins to output in the configuration. These examples would not work anymore the same way, unless you explicity force the data direction back to input before starting the programs. Sorry to torpedo a good idea.... Harm PicomiteVGA PETSCII ROBOTS |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 9810 |
Harm I don't want to give up on the concept as the previous concept of having to specify side pins to allow setting sideset pins and out pins as outputs is clearly flawed. My current thought is to add an extra parameter "OPT" to the end of PIO INIT MACHINE. This will add one to the sideset count but not automatically set the "extra" pin as an output. It will break existing programs that rely on the opt construct but the change should be minimal. I'll test on the uart prog. Please provide links for any others you think I should test UPDATE Of course I don't need an extra parameter as bit 30 of execctrl tells me if I need to reduce the sideset count by one. Tested on UART and works with no code changes You can however simplify a bit PIO ASSEMBLE 1,".program uart_tx" 'uart tx program from RP2040 datasheet PIO ASSEMBLE 1,".side_set 1 opt" 'side set 1 bit + opt=side enable PIO assemble 1,".line 0" 'start of PIO program memory ' PIO ASSEMBLE 1,"set pindirs, 1" 'NOT NEEDED PIO ASSEMBLE 1,".wrap target" 'return point for wrap PIO ASSEMBLE 1,"pull block side 1 [7]" 'get data from fifo PIO ASSEMBLE 1,"set x, 7 side 0 [7]" 'bit counter 7,6,5,....,0 PIO ASSEMBLE 1,"bitloop:" 'label PIO ASSEMBLE 1,"out pins, 1" 'shift 1 bit out PIO ASSEMBLE 1,"jmp x-- bitloop [6]" 'check if 0, then decrement PIO ASSEMBLE 1,".wrap" 'wrap to target PIO ASSEMBLE 1,".end program"' list" 'write program and list hex values 'configure pio0 StateMachine 0 f0=baud_rate*8 ' a b c d e f g 'a,e=side set c,g=OUT b,f=set ' SIDE PIN doesn't need to be specified p0=Pio(PINCTRL 2,,1, ,gp0,,gp0) 'note:2=include side enable bit e0=Pio(execctrl gp1,Pio(.wrap target),Pio(.wrap),0,1 )'1=side set only when defined s0=Pio(shiftctrl 0,0,0,0,0,1,0,0) 'shift OUT direction LSB first 'write the configuration PIO init machine 1,0,f0,p0,e0,s0,0 'SM0 start at address 0 Edited 2025-01-20 05:14 by matherp |
||||
Volhout Guru ![]() Joined: 05/03/2018 Location: NetherlandsPosts: 4723 |
Hi Peter, I will play with it when you have a version available. Need to check that it is compliant with the earlier created code. By the way, I checked through my code, becuase I remembered I ran into this earlier, and it was the PIO code for the second NES controller on the PicoGameVGA (Mick/Tom) design. Where one output (GP22) was way out of range of the other pins (GP1...PG5) for both NES controllers. Then I used MOV in stead of SET. Because MOV uses the same IO pin range as OUT. So when you define a pin for the OUT range, it also works for MOV. Not for SET, not for SIDE SET. Volhout PicomiteVGA PETSCII ROBOTS |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 9810 |
What is the best version to post for you to test? RP2040 VGA? |
||||
Volhout Guru ![]() Joined: 05/03/2018 Location: NetherlandsPosts: 4723 |
Hi Peter, I currently experiment on PicoMite RP2040 (normal, non VGA) because I can use both PIO's. I am still waiting for the final parts on my 2350 USB board. Everything was in before Christmas, except for the USB connectors. Still waiting.... And Chineese new year is looming... Volhout PicomiteVGA PETSCII ROBOTS |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 9810 |
Here you go PicoMite.zip |
||||
Volhout Guru ![]() Joined: 05/03/2018 Location: NetherlandsPosts: 4723 |
Hi Peter, I had to change to UART program a little, but now it runs on the new version. One thing I did not see comming is that the GP0 pin was set output ... low .... when PIO configuration was loaded in PIO INIT MACHINE. Due to the direct connection between UART RX and UART TX, the RX received a BREAK character without STOP -> framing error, until I started UART TX PIO. Work around: So now (in MMBasic) I start PIO 1.0 (UART_TX), and STOP it without even a DMA. That forces the GP0 line high. Only then I start the UART RX. The same must have happened also in the PIO TX code itself, but for the duration of 1 PIO clock (1/8 bit time). And that was too short for the RX to register. This is not something you can solve any way, since MMBasic is not aware what the PIO program actually does, and MMBasic commands execute slower than PIO. Volhout P.M. It is ultimately your decission, but it may cause more confusion than that it actually helps people. If you decide to keep the pindirection set in PINCTRL, please also provide a 2040 VGA version, since the logic analyzer, the frequency counter, the NES controller, SSTV, the AWG (sine/square/triangle wave generator), all run on VGA. I may be able to test these in the comming days. Edited 2025-01-20 21:27 by Volhout PicomiteVGA PETSCII ROBOTS |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 9810 |
V6.00.02b1 is now available on https://geoffg.net/Downloads/picomite/PicoMite_Beta.zip Bug fixes DMA to/from PIO2 on the RP2350 now works Fixes incorrect listing in OPTION LIST for HEARTBEAT New functionality Setting pins as outputs in the pinctrl parameter of PIO INIT MACHINE will now configure those pins as outputs. This overcomes a previous restriction that OUT pins had to be contiguous with SIDE pins in order for them to be used. RP2350 only OPTION AUDIO I2S BCLKpin, DATApin This allows a I2S DAC to be used to provide high quality Audio. The firmware transmits the data in 32-bit mode and FLAC, MP3, and WAV data is output with no loss of information. This command reserves BCLKpin and BCLKpin+1 for the bit clock and word clock and Datapin for the I2S data. It requires an I2S DAC that can PLL the bitclock to create its own master clock. Tested on PCM5102A and TDA1387T . For example: OPTION AUDIO I2S GP1,GP5 GP1 is the bit clock GP2 is the word clock GP5 is the data pin All normal audio should work TONE, MP3, FLAC, WAV, MOD, SOUND Note that you will see jitter on the BCLK. For the CPU at 150MHz the PIO needs to run at 44100*128 = 5644800 = 1/26.57 of the CPU clock speed. The way the H/W does this is to add or subtract clock ticks to the length of the PIO clock to give an average of 26.57 CPU ticks per PIO clock - hence jitter. |
||||
karlelch![]() Senior Member ![]() Joined: 30/10/2014 Location: GermanyPosts: 218 |
`MM.INFO$(LINE)` is not working as (I) expected: Called from the command line, it returns a string (e.g., "UNKNOWN") Called from a program, the editor converts it upon the next loading to `MM.INFO(LINE)` (no dollar sign) and the call returns a number (e.g., if called from a library, a 0) |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 9810 |
It is working how programmed. MM.INFO and MM.INFO$ are the same and always converted in a program to MM.INFO. "UNKNOWN" makes more sense at the command line than -1 Edited 2025-01-21 04:17 by matherp |
||||
javavi![]() Guru ![]() Joined: 01/10/2023 Location: UkrainePosts: 402 |
PicoMiteHDMI MMBasic RP2350A Edition V6.00.02b1 DIR$ fixed! EDIT FILE "fname" from the program seems to be broken ![]() (causes an incomprehensible error in the function that returns the file name to this command) EDIT FILE GetName() Edited 2025-01-21 05:44 by javavi |
||||
karlelch![]() Senior Member ![]() Joined: 30/10/2014 Location: GermanyPosts: 218 |
Ok, thanks. Makes sense. Missed this in the manual. Best Thomas |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 9810 |
DIT FILE "fname" from the program seems to be broken More info needed - version, main program or library /flash slot etc. |
||||
Volhout Guru ![]() Joined: 05/03/2018 Location: NetherlandsPosts: 4723 |
Hi Peter, I have been politely trying to discourage you to automate pindirs in PIO INIT MACHINE. Obviously I failed. Let me be blunt. This is a bad idea. Undo that change, or make it optional. You are crippling PIO. I will try one more time to explain why. There is a reason that microcontrollers start with all pins being input. So the software can decide how to use a certain pin. Can you imagine software starting with all pins it ever wants to set output (an interrupt output, a bi-dir pin, a watchdog pin, I2C) set hard low before the code starts ? This is a hardware nightmare. But that is what PIO INIT MACHINE does in this last release. Everything happens before PIO START, so there is no way PIO can UNDO it. Sorry, but this "automatic pindirs" is a bad change. Undo it. Volhout PicomiteVGA PETSCII ROBOTS |
||||
![]() ![]() ![]() ![]() |
![]() |