Issue with sdcard and (save-image) or (load-image)


Hi David ,
Could it be that I discovered a flaw when sdcard is enabled in ulisp ?
It seems that (load-image) or (save-image) only work when a read or write to sdcard has been done before. If not the an error is thrown ‘problem saving to sdcard’.
I tried copying the line with SD.begin(SDCARD_SS_PIN, SPI1) to the setup part of the arduino IDE , and then it works !
What is your opinion about this ?
Kind regards ,


I haven’t noticed this before, but I’ll check it.

Can you give a bit more information about what version of uLisp, what platform, and what board you’re using.

Thanks, David


Hi David ,

I’m using ulisp 4.5 for ARM on a non official board , being the sparkfun rp2040 thing plus.
I made some small adjustments in the code.


Just to check the problem; is this correct:

  • The command (save-image) gives the error “problem saving to sdcard”.

  • Now you do something like:

  • (with-sd-card (str "Greeting.txt" 2) (print "Hello" str))
  • which works, and now (save-image) works without error.

Is it worth me getting a Sparkfun RP2040 Thing Plus board to try it out?


Yes , the problem is exactly as you describe.
You could get yourself such a board if you like :-)
I also could try this on a rpi pico w if you like.
It was just a ‘lucky’ coincidence noticing this.


David ,
I can confirm that a rpi pico w doesn’t have this issue.
Maybe I did something wrong in the changes.
I will see if I can find something



This is the output of the sparkfun board :
(after a power cycle)

22820> uLisp 4.5
22820> (save-image)
Error: ‘save-image’ problem saving to SD card
22820> (with-sd-card (str “Greeting.txt”)
(read str))

22820> (save-image)



I can confirm that a rpi pico w doesn’t have this issue.

Thanks for checking. How did you connect an SD Card socket to it?


do you mean for the rpi or the sparkfun ?
the sparkfun has an on board sdcard , that why I liked this board.
for the rpi it is connected to gp16,gp17 ,gp18 , gp19 resp. spi0_rx,spi0_cs, spi0_sck,spi0_tx


My guess is that for some reason the call in sp_withsdcard():


is working, but the one in saveimage() isn’t. Since I don’t call:


the SD interface stays enabled and the second call to SD.begin() is ignored.


David ,
I’m sorry for this , but it’s my fault !
Your last message did the trick. I forgot to change sdbegin with the addition of SPI1 in save-image.
So it’s working now. I’ve changed all sd.begin( ) with SPI1.
Thanks again , and sorry for your time.

Regards ,


Glad you solved it!