Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 05:38 02 Aug 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Newbie question on storing basic programs on an sd card

Author Message
k2backhoe
Regular Member

Joined: 04/12/2021
Location: United States
Posts: 47
Posted: 09:45pm 06 Dec 2021
Copy link to clipboard 
Print this post

Hello, pardon my newbie learning curve.  I have mmbasic 5.07.01 running on a pi pico.  I have learned enough to run servos and to send light patterns out on a WS2812B string.  I am trying to store and retrieve basic programs onto an SD card.  I am using a wishiot SD card reader via an spi interface.  The user manual (5.01.01) gives differing commands on page 36 (SD card support) and page 132 (SPI communications).  I tried both, but I get different errors on each.  Could anyone point me to an example of working code (and wiring if possible)?  

Thanks in advance
k2
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 7937
Posted: 10:24pm 06 Dec 2021
Copy link to clipboard 
Print this post

I suspect that that breakout board won't work on the PicoMite. It's designed for connection to 5v systems like the Arduino, whereas the PicoMite is 3.3v only. What you need is a direct connected breakout board, where the connections on the SDcard socket are simply wired directly to the pins.
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
FeK9
Newbie

Joined: 04/12/2021
Location: South Africa
Posts: 16
Posted: 10:27pm 06 Dec 2021
Copy link to clipboard 
Print this post

  k2backhoe said  Hello, pardon my newbie learning curve.  I have mmbasic 5.07.01 running on a pi pico.  I have learned enough to run servos and to send light patterns out on a WS2812B string.  I am trying to store and retrieve basic programs onto an SD card.  I am using a wishiot SD card reader via an spi interface.  The user manual (5.01.01) gives differing commands on page 36 (SD card support) and page 132 (SPI communications).  I tried both, but I get different errors on each.  Could anyone point me to an example of working code (and wiring if possible)?  

Thanks in advance
k2


GDay from one Newbie to another... :)

I also got my MOSI's and MISO's mixed up.

My Pi Pico is on a daughter board from Cytron called 'Maker Pi Pico', it
comes with SDCard slot...

Perhaps you can post your contents of your option list, mention the SDCard slot
module you have.  I use a Sandisk 8GB, and it works fine...

Bellow is the contents of my Option, I've also been tinkering Audio.

> option list
OPTION SDCARD GP15
OPTION SYSTEM SPI GP10,GP11,GP12
OPTION Audio GP18,GP19, on PWM channel 1
> files
A:/
       46  fox.txt
      142  toggle1819.BAS
  2058994  TomsDiner8.wav
      102  tone.BAS
0 directories, 4 files
>
 
FeK9
Newbie

Joined: 04/12/2021
Location: South Africa
Posts: 16
Posted: 10:53pm 06 Dec 2021
Copy link to clipboard 
Print this post

I'm with Mixtel90 on this one...

It's middle of the night here, didn't see at first you mention wishiot SD card.
 
phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 2642
Posted: 12:28am 07 Dec 2021
Copy link to clipboard 
Print this post

A 5V SD adapter on a 3.3V system may work for many SD cards, but not all. It is worth a try. I have used one on an MX170. The LDO regulator reduces the 3.3V to about 3V which is on the border. The level shifters on the data pins don't affect the levels too much.
 
k2backhoe
Regular Member

Joined: 04/12/2021
Location: United States
Posts: 47
Posted: 02:38am 07 Dec 2021
Copy link to clipboard 
Print this post

As in page 36 of the user manual, I am using gp22 for card enable, gp19 for mosi, gp18 for clock, gp16 for miso.  For sd card power I use Vbus (pin 40) which should give a full 5V. my program is

'THIRD TEST PROGRAM, CONTROLLING A SD CARD READER
Option AUTORUN ON
Option colourcode on
Option sdcard gp22
Option system spi gp18, gp19, gp16
Open "FOX.TXT" For OUTPUT As #1
Print #1, "THE QUICK BROWN FOX"
Print #1, "WITH SIX DOZEN LIQUOR JUGS"
Close #1


> option list
OPTION AUTORUN ON
OPTION COLOURCODE ON
OPTION SYSTEM SPI GP18,GP19,GP16
> files
Error : SDcard not configured
> run
[4] Option sdcard gp22
Error : Pin 0 is in use
>
 
FeK9
Newbie

Joined: 04/12/2021
Location: South Africa
Posts: 16
Posted: 04:52am 07 Dec 2021
Copy link to clipboard 
Print this post

I see you have options in your program, at mo from my limited (newbie)
understanding of MMbasic I'm not sure if options can be put in a
program listing? I think options should only be shown in the options list...

The one option that sticks out is Option sdcard gp22 it should
show in the options listing. At the prompt type in that line, it
should cause the Pico to reboot.

Then do a options listing, it should look a little like shown below. Also
for the moment clear out your program listing of options...

On the wishiot SD card module...
Both an SD card and the Pi Pico are 3.3 volt devices, and nether
are 5 volt tolerant. On the module see a little chip next to the card slot,
that probably the level shiftier, it rises or lowers the signal to the
SD card. The Pico it self probable saw levels closer to 5 volts, not a good.  

> option list
OPTION AUTORUN ON
OPTION COLOURCODE ON
OPTION SYSTEM SPI GP18,GP19,GP16
OPTION SDCARD GP22
 
k2backhoe
Regular Member

Joined: 04/12/2021
Location: United States
Posts: 47
Posted: 03:38am 08 Dec 2021
Copy link to clipboard 
Print this post

OK great.  Got it working.  I am now writing up a very simple and (hopefully) unambiguous example. I will append it to the end of this thread for other newbies as easily confused as I was.

Thanks everyone, k2
 
FeK9
Newbie

Joined: 04/12/2021
Location: South Africa
Posts: 16
Posted: 03:03pm 09 Dec 2021
Copy link to clipboard 
Print this post

  k2backhoe said  OK great.  Got it working.  I am now writing up a very simple and (hopefully) unambiguous example. I will append it to the end of this thread for other newbies as easily confused as I was.

Thanks everyone, k2

+1  

I've also found a shortage of small minimal working examples while trolling these
forums. I believe the manual is a work in progress while the PicoMite firmware is
evolving.

On the options thing it seems there are two types, one that occur in program listings
(transitory) and others that are more permanent and show in the option's list. A little like 'config.sys' and 'autoexec.bat' from Dos day's...

FeK9 :)
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 7937
Posted: 03:32pm 09 Dec 2021
Copy link to clipboard 
Print this post

You may find the Options a little confusing at first, but generally if one is ticked as Permanent then you have to enter it at the command line. Some will reset the device when changed. Most non-permanent Options can be used in a program, but OPTION LIST and OPTION RESET are immediate commands.
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4311
Posted: 03:37pm 09 Dec 2021
Copy link to clipboard 
Print this post

  FeK9 said  I've also found a shortage of small minimal working examples while trolling these forums.


I think you mean "trawling", if you'd been "trolling" you would probably have been kicked off TBS by now. When it comes to examples then if you mean general BASIC examples any piece of 80's BASIC can be made to work with little effort, perhaps look here http://www.vintage-basic.net/games.html. If you mean programs that flash LEDs then old threads for the PIC32 'mites on TBS may be your best bet, just say what you are looking for and someone will probably help.

  FeK9 said  I believe the manual is a work in progress while the PicoMite firmware is evolving.


Whilst there is some ongoing editorial work in the former and titivating of the latter going on I think what we have now is basically the finished article.

Best wishes,

Tom
MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
FeK9
Newbie

Joined: 04/12/2021
Location: South Africa
Posts: 16
Posted: 04:34pm 09 Dec 2021
Copy link to clipboard 
Print this post

@thwill

Look at my post from the OP perspective, he knows I'm talking about PicoMite.
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4311
Posted: 05:18pm 09 Dec 2021
Copy link to clipboard 
Print this post

  FeK9 said  Look at my post from the OP perspective, he knows I'm talking about PicoMite.


Now I'm confused , what made you think I was not?

Best wishes,

Tom
MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025