Arduino IDE compile runs, PlatformIO has errors

Using Adafruit Feather M0 and ILI9341 with SD card read/write breakout. I have compiled code that works with the TFT display and can read/write the SD card. But recently, code compiled on PlatformIO won’t access the SD card after a write to the TFT display. The same code compiled on Arduino IDE runs and accesses the SD card. Do I have something configured wrong?

Without your platformio.ini, code, the used Arduino core version for your board, your Arduino IDE configuration and the versions of the libraries you used in the Arduino IDE there’s an almost 0% chance that anything meaningful can be said about your error.

I’ve been getting along by using the Arduino IDE when I need to use SD cards and Adafruit TFT displays together, but I would really like to be able to get back to using PIO exclusively because it’s so much nicer.

The program compiles OK on both IDEs. When I compile on PlatformIO, I can open and write SD files that are above the TFT initialization, but I always get errors opening SD files if the TFT display has been started. Everything works as it should when compiled on the Arduino IDE.

If I am missing any needed info, please let me know.

Here is the platformio.ini file:
(this program was compiled for the Adafruit QT Py M0, but I have had the same problem with Adafruit Feather M0 and M4 boards.)

platform = atmelsam
board = adafruit_qt_py_m0
framework = arduino
lib_deps =
sparkfun/SparkFun Qwiic Scale NAU7802 Arduino Library@^1.0.4
adafruit/Adafruit ILI9341@^1.6.0
adafruit/Adafruit ST7735 and ST7789 Library@^1.10.3
adafruit/Adafruit SHT4x Library@^1.0.4

here is the Arduino IDE version:

Version: 2.3.1
Date: 2024-02-15T09:01:25.701Z
CLI Version: 0.35.2

Copyright © 2024 Arduino SA

Libraries in the Arduino IDE:
Adafruit_ST7735.h v1.10.3
SD.h SD by Arduino, Sparkfun v1.2.4
I wasn’t able to find “Wire.h” in the Arduino library, but somehow, it compiled
SparkFun Qwiic Scale NAU7802 Arduino Liberary v1.0.4
Adafruit GFX v1.11.9
I wasn’t able to find “SPI.h” in the Arduino library
Adafruit FRAM I2C v2.0.3
Adafruit SHT4x Library v 1.0.4