Sd card file error when using I2C 2

The official pyboard running MicroPython.
This is the reference design and main target board for MicroPython.
You can buy one at the store.
Target audience: Users with a pyboard.
Post Reply
timonjacquemin
Posts: 3
Joined: Sat May 07, 2022 7:09 pm

Sd card file error when using I2C 2

Post by timonjacquemin » Sat Oct 08, 2022 5:06 pm

Hello everyone,

I ran into a problem, i'm trying to use a pyboard to record datas of both an gyro-accelerometer (on I2C 1) and a barometer (on I2C 2).
So i made a basic code that get all datas and store them in a file on the sd card... The thing is the file always get corrupted.

So as we all do, i tried removing parts of the code to see what specificaly was causing the problem and it seems that it's the barometer, if i comment out EVERYTHING linked to I2C 2 the file is ok...

So, is it impossible to use both an sd card and I2C 2 at the same time? And if not, what could be causing the problem?

Regards, Timon

User avatar
scruss
Posts: 360
Joined: Sat Aug 12, 2017 2:27 pm
Location: Toronto, Canada
Contact:

Re: Sd card file error when using I2C 2

Post by scruss » Sat Oct 08, 2022 5:35 pm

Please use Github Discussions - this site is no longer read by people who know what they're doing.

Without the code, how can we tell what's going wrong?

If you have the SD card mounted as USB storage on your computer, that can cause corruption and is not recommended.

User avatar
jimmo
Posts: 2754
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia
Contact:

Re: Sd card file error when using I2C 2

Post by jimmo » Sat Oct 08, 2022 10:07 pm

timonjacquemin wrote:
Sat Oct 08, 2022 5:06 pm
So, is it impossible to use both an sd card and I2C 2 at the same time? And if not, what could be causing the problem?
Definitely possible.

Need to see your code. Please post to GitHub Discussions.

Post Reply