Rocksolid Light

Welcome to Rocksolid Light

mail  files  register  newsreader  groups  login

Message-ID:  

"What the scientists have in their briefcases is terrifying." -- Nikita Khrushchev


devel / comp.lang.forth / ESP32Forth SD Card Initialization

SubjectAuthor
* ESP32Forth SD Card InitializationVan Kichline
+- Re: ESP32Forth SD Card InitializationVan Kichline
`* Re: ESP32Forth SD Card InitializationDavid Schultz
 `* Re: ESP32Forth SD Card InitializationVan Kichline
  `- Re: ESP32Forth SD Card InitializationDavid Schultz

1
ESP32Forth SD Card Initialization

<c2e1709c-53b2-490b-9f15-6ae24d1c5e19n@googlegroups.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=24440&group=comp.lang.forth#24440

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a37:ad06:0:b0:76f:454:8e6a with SMTP id f6-20020a37ad06000000b0076f04548e6amr159701qkm.4.1693088117301;
Sat, 26 Aug 2023 15:15:17 -0700 (PDT)
X-Received: by 2002:a05:620a:4706:b0:76d:8404:f1aa with SMTP id
bs6-20020a05620a470600b0076d8404f1aamr700930qkb.5.1693088117058; Sat, 26 Aug
2023 15:15:17 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!1.us.feeder.erje.net!feeder.erje.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Sat, 26 Aug 2023 15:15:16 -0700 (PDT)
Injection-Info: google-groups.googlegroups.com; posting-host=50.46.222.216; posting-account=VRZdRQoAAAByg2veNn4xonsritzF12hS
NNTP-Posting-Host: 50.46.222.216
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <c2e1709c-53b2-490b-9f15-6ae24d1c5e19n@googlegroups.com>
Subject: ESP32Forth SD Card Initialization
From: vkichline@gmail.com (Van Kichline)
Injection-Date: Sat, 26 Aug 2023 22:15:17 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 2176
 by: Van Kichline - Sat, 26 Aug 2023 22:15 UTC

I'm having quite a bit of trouble using SD cards with Esp32Forth.
I have exactly one setup that works: An Adafruit ESP32 Feather with an AdaLogger board (which contains an SD card socket.)
Many boards don't have a setting in the Arduino IDE 2.0, such as the LilyGo T8 which includes an SD socket. I find I can modify the SD Test example program to work correctly with this board by replacing SD.begin() with:
SPI.begin(14, 2, 15, 13); //SCK, MISO, MOSI, SS
SD.begin(13);
(Both changes are required.)
However, I've been unable to introduce these changes to Esp32Forth successfully.
I've modified the Forth definition of SD.begin to call the C function SD.begin(13). I modified SD.beginDefaults to push 13 rather than SS. I added SPI.begin(14, 2, 15, 13); to the end of setup(), but when I start Esp32Forth and enter:
SD SD.begin
it always returns 0. (It returns a 1 on success.)
I have several other boards with similar issues, I just cannot get the SD to initialize, but can run the (modified) SD Test program on them successfully.
Can someone provide some guidance on how to get the SD up and running on Esp32Forth when SD.begin does not succeed?
Thanks for your time!

Re: ESP32Forth SD Card Initialization

<42b1bdf6-d663-4158-bd20-f92fe9a558d3n@googlegroups.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=24442&group=comp.lang.forth#24442

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:620a:46a5:b0:76d:567a:42f0 with SMTP id bq37-20020a05620a46a500b0076d567a42f0mr847752qkb.3.1693104313933;
Sat, 26 Aug 2023 19:45:13 -0700 (PDT)
X-Received: by 2002:ac8:7f4c:0:b0:410:9a8b:bf52 with SMTP id
g12-20020ac87f4c000000b004109a8bbf52mr672714qtk.6.1693104313729; Sat, 26 Aug
2023 19:45:13 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!nntp.club.cc.cmu.edu!45.76.7.193.MISMATCH!3.us.feeder.erje.net!feeder.erje.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Sat, 26 Aug 2023 19:45:13 -0700 (PDT)
In-Reply-To: <c2e1709c-53b2-490b-9f15-6ae24d1c5e19n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=50.46.222.216; posting-account=VRZdRQoAAAByg2veNn4xonsritzF12hS
NNTP-Posting-Host: 50.46.222.216
References: <c2e1709c-53b2-490b-9f15-6ae24d1c5e19n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <42b1bdf6-d663-4158-bd20-f92fe9a558d3n@googlegroups.com>
Subject: Re: ESP32Forth SD Card Initialization
From: vkichline@gmail.com (Van Kichline)
Injection-Date: Sun, 27 Aug 2023 02:45:13 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 2156
 by: Van Kichline - Sun, 27 Aug 2023 02:45 UTC

A little more info from trying to get the LilyGo T8's SD card working on ESP32Forth:
At the top of ESP32forth.ino, I inserted:
#define SS 13
#define MOSI 15
#define MISO 2
#define SCK 14
I changed XV(SD, "SD.begin", SD_BEGIN, PUSH SD.begin()) to XV(SD, "SD.begin", SD_BEGIN, PUSH SD.begin(SS))
I added a bit of extra code:
void print_pins() { printf("SCK=%d, MOSI=%d, MISO=%d, SS=%d\n", SCK, MOSI, MISO, SS); }
....and added a word to OPTIONAL_SD_SUPPORT:
XV(SD, "SD.Pins", SD_PINS, print_pins())

I have also added the following to setup():
SPI.begin(14, 2, 15, 13); //SCK, MISO, MOSI, SS

SD.begin still fails, simply returning zero.
SD.Pins returns: SCK=14, MOSI=15, MISO=2, SS=13 (as expected) if and only if I include the SPI.begin(14, 2, 15, 13); in setup().

Also, I found that adding the 4 #defines to the SD Test example had no effect, I could not eliminate either of the required changes for the LilyGo T8 board.
The #defines do make SD.beginDefaults return the correct SS, however.

Re: ESP32Forth SD Card Initialization

<-IudnZRoX_lhwHb5nZ2dnZfqnPqdnZ2d@earthlink.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=24448&group=comp.lang.forth#24448

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!1.us.feeder.erje.net!feeder.erje.net!border-1.nntp.ord.giganews.com!border-2.nntp.ord.giganews.com!nntp.giganews.com!Xl.tags.giganews.com!local-1.nntp.ord.giganews.com!nntp.earthlink.com!news.earthlink.com.POSTED!not-for-mail
NNTP-Posting-Date: Sun, 27 Aug 2023 14:30:20 +0000
Date: Sun, 27 Aug 2023 09:30:20 -0500
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.13.0
From: david.schultz@earthlink.net (David Schultz)
Subject: Re: ESP32Forth SD Card Initialization
Newsgroups: comp.lang.forth
References: <c2e1709c-53b2-490b-9f15-6ae24d1c5e19n@googlegroups.com>
Content-Language: en-US
In-Reply-To: <c2e1709c-53b2-490b-9f15-6ae24d1c5e19n@googlegroups.com>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Message-ID: <-IudnZRoX_lhwHb5nZ2dnZfqnPqdnZ2d@earthlink.com>
Lines: 24
X-Usenet-Provider: http://www.giganews.com
NNTP-Posting-Host: 108.194.108.63
X-Trace: sv3-BAziuxBPRVXR0Ma8bGmAuTgDUusGKvcqFbpSGwFKyHAZ9T1xKibXB2jIfhEgB92KM9dyEP+kQAEs1nB!QCw6ILQCdI2bM589uKFLcdufGiqDNqNF/76NMTRevAoze0fVMeVoLT78PS1OYVO/fKdjDmp9rUd6!CMhnvCAzmNg7alN0pdWMmG4xcfJGP7WtqprqtHJWVg==
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.40
 by: David Schultz - Sun, 27 Aug 2023 14:30 UTC

On 8/26/23 5:15 PM, Van Kichline wrote:
> I'm having quite a bit of trouble using SD cards with Esp32Forth.

I have some SD card code in eForth (sort of) for both the MSP430 and
ARM. (MSP430 uses the SPI interface while the ARM uses 4 bit SD.) I
don't use Arduino unless forced to so I can't help with that.

The sort of refers to having to code it in assembler so it was part of
eForth. Compiling from the SD card being kind of hard without it. :-)

http://davesrocketworks.com/electronics/msp430/eforth/index.html

You will of course want to read the SD (simplified) specification.

https://www.sdcard.org/downloads/pls/

Up to version 9.0 now I see. Full up initialization can be quite
complicated if you want to support SD 1.0 and MMC cards.

--
http://davesrocketworks.com
David Schultz

Re: ESP32Forth SD Card Initialization

<267ebe5b-e8b3-458d-bb1d-6ea0cf2ddfd2n@googlegroups.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=24452&group=comp.lang.forth#24452

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:ad4:4144:0:b0:64f:92d1:4871 with SMTP id z4-20020ad44144000000b0064f92d14871mr183349qvp.6.1693179661128;
Sun, 27 Aug 2023 16:41:01 -0700 (PDT)
X-Received: by 2002:a05:6214:9b4:b0:649:3fe5:70b0 with SMTP id
du20-20020a05621409b400b006493fe570b0mr708307qvb.11.1693179660785; Sun, 27
Aug 2023 16:41:00 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Sun, 27 Aug 2023 16:41:00 -0700 (PDT)
In-Reply-To: <-IudnZRoX_lhwHb5nZ2dnZfqnPqdnZ2d@earthlink.com>
Injection-Info: google-groups.googlegroups.com; posting-host=50.46.222.216; posting-account=VRZdRQoAAAByg2veNn4xonsritzF12hS
NNTP-Posting-Host: 50.46.222.216
References: <c2e1709c-53b2-490b-9f15-6ae24d1c5e19n@googlegroups.com> <-IudnZRoX_lhwHb5nZ2dnZfqnPqdnZ2d@earthlink.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <267ebe5b-e8b3-458d-bb1d-6ea0cf2ddfd2n@googlegroups.com>
Subject: Re: ESP32Forth SD Card Initialization
From: vkichline@gmail.com (Van Kichline)
Injection-Date: Sun, 27 Aug 2023 23:41:01 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 2808
 by: Van Kichline - Sun, 27 Aug 2023 23:41 UTC

On Sunday, August 27, 2023 at 7:30:32 AM UTC-7, David Schultz wrote:
> On 8/26/23 5:15 PM, Van Kichline wrote:
> > I'm having quite a bit of trouble using SD cards with Esp32Forth.
> I have some SD card code in eForth (sort of) for both the MSP430 and
> ARM. (MSP430 uses the SPI interface while the ARM uses 4 bit SD.) I
> don't use Arduino unless forced to so I can't help with that.
>
> The sort of refers to having to code it in assembler so it was part of
> eForth. Compiling from the SD card being kind of hard without it. :-)
>
> http://davesrocketworks.com/electronics/msp430/eforth/index.html" rel="nofollow" target="_blank">http://davesrocketworks.com/electronics/msp430/eforth/index.html
>
> You will of course want to read the SD (simplified) specification.
>
> https://www.sdcard.org/downloads/pls/
>
> Up to version 9.0 now I see. Full up initialization can be quite
> complicated if you want to support SD 1.0 and MMC cards.
>
>
> --
> http://davesrocketworks.com
> David Schultz
Thanks for this! I believe my main problem is that the Arduino IDE does some "magic" to set the SPI pins when a board is selected, and I can't find any detailed documentation about how that's done, or how to compensate when there is no compatible board definition. After doing more research on this, it really looks like an Arduino question more than a Forth question. Some seem to have solved this specific problem for Esp32Forth; I was just hoping to find someone with a simple pattern to follow. I'm not lazy, but when IDE's rely on magic, sometimes you need to find a magician.

Re: ESP32Forth SD Card Initialization

<fdCcnRbHAJcZd3b5nZ2dnZfqnPudnZ2d@earthlink.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=24453&group=comp.lang.forth#24453

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!feeder.usenetexpress.com!tr2.iad1.usenetexpress.com!69.80.99.26.MISMATCH!Xl.tags.giganews.com!local-2.nntp.ord.giganews.com!nntp.earthlink.com!news.earthlink.com.POSTED!not-for-mail
NNTP-Posting-Date: Mon, 28 Aug 2023 00:29:56 +0000
Date: Sun, 27 Aug 2023 19:29:56 -0500
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0
Subject: Re: ESP32Forth SD Card Initialization
Newsgroups: comp.lang.forth
References: <c2e1709c-53b2-490b-9f15-6ae24d1c5e19n@googlegroups.com> <-IudnZRoX_lhwHb5nZ2dnZfqnPqdnZ2d@earthlink.com> <267ebe5b-e8b3-458d-bb1d-6ea0cf2ddfd2n@googlegroups.com>
Content-Language: en-US
From: david.schultz@earthlink.net (David Schultz)
In-Reply-To: <267ebe5b-e8b3-458d-bb1d-6ea0cf2ddfd2n@googlegroups.com>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Message-ID: <fdCcnRbHAJcZd3b5nZ2dnZfqnPudnZ2d@earthlink.com>
Lines: 20
X-Usenet-Provider: http://www.giganews.com
NNTP-Posting-Host: 108.194.108.63
X-Trace: sv3-W4V+LD4WdwhFiRVbIZkn9w11aktoascZdPIoIFw9+TLqprH9kOZG5ijbvxiT7g6eH7dfoDL6zZ+1R4M!HyQboFZhDxjDqsxLB9zQBgPXOVJwpPzZMZAAtZxKbRNM7FJzgUqG7Tq5NKqjMRrCYwJycJj7N9zp!tUX4Gk496tZ2mylq+3qCbIZ2ezV7u0EE1YiB/CFMAg==
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.40
 by: David Schultz - Mon, 28 Aug 2023 00:29 UTC

On 8/27/23 6:41 PM, Van Kichline wrote:
> Thanks for this! I believe my main problem is that the Arduino IDE
> does some "magic" to set the SPI pins when a board is selected, and I
> can't find any detailed documentation about how that's done, or how
> to compensate when there is no compatible board definition. After
> doing more research on this, it really looks like an Arduino question
> more than a Forth question. Some seem to have solved this specific
> problem for Esp32Forth; I was just hoping to find someone with a
> simple pattern to follow. I'm not lazy, but when IDE's rely on
> magic, sometimes you need to find a magician.
The magic is inside source files which are hiding somewhere in the
library distribution. Compiled from scratch each time you start up the
IDE. So find them, then dig around till you find the source file you
need to fiddle with. If you are lucky there will already be an option to
do what you want. If you are very lucky it will be well commented.

--
http://davesrocketworks.com
David Schultz

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor