Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 11:00 01 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 : SD Card on Pico System SPI

Author Message
ville56
Senior Member

Joined: 08/06/2022
Location: Austria
Posts: 223
Posted: 11:27am 14 Jun 2022
Copy link to clipboard 
Print this post

Hi all,

as i'm new to the forum let me just briefly introduce myself. I'm a retired IT (Industry and Banking) pro and have programmed for many years in Basic (VAX/VMS) and also have a reasonable background in electronics. I also have a ham radio license (OE1HGA) and this leads to my current project. I want to revive my ICOM IC-PCR1000 broadband receiver and the Pico with PicoMite Basic is a good platform to achieve this goal. Revive, because the Windows software to control the device is making more and more problems with every version of Windows, even if running on virtual host.

The pico software has already take shape and many basic functions are running and let me control the receiver in wide parts via touch screen. Having the least number of buttons, pots and encoders is also a goal.

The problem i have is using a SD Card interface on the system SPI pins (clk, mosi, miso). The scope shows that CS is asserted, clk is running for some periods but no level change on mosi and miso. Files command says that there is no SD card. A lcd screen on the same pins works like a charm, CS of course, is different. SD card on other pins than system SPI works without problems. But this is not my preferred solution as, i fear, i will run out of pins for any further extensions.

Are there some limitations i have overlooked or any known problems with running SD card on system SPI?

The effect is the same on the current version as on the current beta. I'v tried it with different lcd-screens, even without lcd to no avail. So it appears as not to be tied to the hardware i'm using. Running out of ideas now ....

Any help is welcome.

Regards,
Gerald
                                                                 
73 de OE1HGA, Gerald
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10310
Posted: 11:31am 14 Jun 2022
Copy link to clipboard 
Print this post

If the LCD has touch then this must be configured otherwise it will corrupt SD transfers. If the LCD is a ILI9488 then MISO should not be connected (or connected via a 680ohm resistor).

More info on your configuration would be helpful
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 5089
Posted: 11:36am 14 Jun 2022
Copy link to clipboard 
Print this post

Hi Gerald,

There are 2 different builds for the picomite. One with VGA, and one without.
If you are using the pico with VGA, you can, and have to, assign the sd card pins in an OPTION SDCARD
This is because the VGA picomite does not have a system spi bus.

The normal picomite has support for a spi lcd display, and can share the spi bus with the sd card. For the normal picomite you have to assign the system spi bus, and appart from that assign the sdcard CS pin.

This is described in the user manuals. But you can get confused if you read the normal picomite manual and try to use the examples on the VGA picomite.
PicomiteVGA PETSCII ROBOTS
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 5089
Posted: 11:38am 14 Jun 2022
Copy link to clipboard 
Print this post

Hi Gerald,

There are 2 different builds for the picomite. One with VGA, and one without.
If you are using the pico with VGA, you can, and have to, assign the sd card pins in an OPTION SDCARD
This is because the VGA picomite does not have a system spi bus.

The normal picomite has support for a spi lcd display, and can share the spi bus with the sd card. For the normal picomite you have to assign the system spi bus, and appart from that assign the sdcard CS pin.

This is described in the user manuals. But you can get confused if you read the normal picomite manual and try to use the examples on the VGA picomite.

If you describe your connections, we may be able to help in more detail.
PicomiteVGA PETSCII ROBOTS
 
ville56
Senior Member

Joined: 08/06/2022
Location: Austria
Posts: 223
Posted: 12:03pm 14 Jun 2022
Copy link to clipboard 
Print this post

Hi Volhout,

thanks for your swift response.

I'm NOT using the VGA build. The options I used in one example are:

OPTION SYSTEM SPI GP10,GP11,GP12
OPTION LCDPANEL ILI9488W, LANDSCAPE,GP8,GP15,GP9,GP13
option SDCARD GP22

So IMHO I proberly share LCD and SD card bus (clk, mosi, miso) AND both are on system SPI.

This works for LCD but NOT for SD card.

I've tried a similar setting with a different LCD (ST7789_320), but SD is also not working.
                                                                 
73 de OE1HGA, Gerald
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10310
Posted: 12:13pm 14 Jun 2022
Copy link to clipboard 
Print this post

If the LCD has touch then this must be configured otherwise it will corrupt SD transfers. Manual page 37
Edited 2022-06-14 22:17 by matherp
 
ville56
Senior Member

Joined: 08/06/2022
Location: Austria
Posts: 223
Posted: 12:33pm 14 Jun 2022
Copy link to clipboard 
Print this post

I've tried to avoid any false response, also any signal collisions

1) the LCD with the ST7789_320 controller has no touch

2) I've also tried to avoid any false response or any signal collisions by stripping down the hardware.

Even LCD/touch is physically not attached and only SD is attached, SD is not working. On the scope you can see data transfer to the (not connected) LCD with TEXT commands but no data transfer on FILES command (only cs and clk are asserted)
                                                                 
73 de OE1HGA, Gerald
 
phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 2640
Posted: 12:46pm 14 Jun 2022
Copy link to clipboard 
Print this post

As @matherp previously noted

"If the LCD has touch then this must be configured otherwise it will corrupt SD transfers. If the LCD is a ILI9488 then MISO should not be connected (or connected via a 680ohm resistor)."

That 680ohm resistor is essential if you have connected MISO to the display. Touch and SD card connect directly to MISO. That particular display has a defect that keeps its Data Out pin active. If directly connected to MISO it blocks SD and touch.
 
ville56
Senior Member

Joined: 08/06/2022
Location: Austria
Posts: 223
Posted: 01:02pm 14 Jun 2022
Copy link to clipboard 
Print this post

in my 2nd testcase there is no LCD panel physically connected to the Pico, just the SD card. So there is no way for the LCD to block MISO. And as long as you do just write to the LCD, the MISO is not used. At least the Basic interpreter does not complain about the unconnected LCD and clocks out the data.
                                                                 
73 de OE1HGA, Gerald
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10310
Posted: 01:06pm 14 Jun 2022
Copy link to clipboard 
Print this post

  Quote  SD card on other pins than system SPI works without problems.

The sd initialisation sends clock pulses and expects the card to pull MISO high. Unless it sees MISO go high then nothing else will happen. The fact that your SD works on other pins suggests something is holding MISO low (or the pin itself is faulty)

What version is your ST7789_320? The Waveshare version has touch and is configured

OPTION SYSTEM SPI GP10,GP11,GP12
OPTION LCDPANEL ST7789_320, LANDSCAPE,GP8,GP15,GP9,GP13
OPTION TOUCH GP16,GP17
GUI CALIBRATE 0, 408, 3901, 900, -646
OPTION SDCARD GP22


The Waveshare ILI9488W is configured

OPTION SYSTEM SPI GP10,GP11,GP12
OPTION LCDPANEL ILI9488W, LANDSCAPE,GP8,GP15,GP9,GP13
OPTION TOUCH GP16,GP17
GUI CALIBRATE 0, 3998, 242, -1281, 860
OPTION SDCARD GP22


I've tested both these with the release firmware and both work perfectly
 
ville56
Senior Member

Joined: 08/06/2022
Location: Austria
Posts: 223
Posted: 01:35pm 14 Jun 2022
Copy link to clipboard 
Print this post

Thanks to all supporters, problem solved, mea culpa!

The config was currently exactly as specified by matherp, so i could sort out config problems.
Reformatting the SD card did solve it. FAT and FAT32 do work. Must have been formatted to something else, but i could swear i did it right the first time.

This still does not explain to me why i did not see any data on mosi/miso when accessing the SD card. Had the scope on single shot to trigger on level change. Will re-investigate that later. Maybe i'm already too senile to properly use a scope ... growing old isn't for cowards.

You are great !!!

Thanks again and regards,
Gerald
                                                                 
73 de OE1HGA, Gerald
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 7937
Posted: 02:58pm 14 Jun 2022
Copy link to clipboard 
Print this post

You have to watch Windows. It has a tendency to format largish USB stuff to exFAT rather than extended capacity FAT32 - and doesn't give you the option to use FAT or FAT32. That can mess a lot of things up.
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
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