Macro file sd/sdhc bug

Any bugs you encounter with Flowcode should be discussed here.
Post Reply
Mcolin
Posts: 11
http://meble-kuchenne.info.pl
Joined: Thu Aug 17, 2023 3:45 am

Macro file sd/sdhc bug

Post by Mcolin »

Component macro

filesd::initialise()

Don't step out on real hardware running.
IMG_20240305_000925.jpg
IMG_20240305_000925.jpg (80.06 KiB) Viewed 272 times
Work flow
1.-Initialise screen
2 - initialise sd module
3- print: finish line code


Please check the complete hardware demo upload video:

https://youtu.be/gAGuB8S4pEk?si=rwANGc9KHbJED69H

BenR
Matrix Staff
Posts: 1739
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 440 times
Been thanked: 603 times

Re: Macro file sd/sdhc bug

Post by BenR »

Hello,

Please can you attach your project file.

Are you using an AVR based micro by any chance? The hardware spi can lock up on these if the ss pin is left floating or allowed to go low. It will need to be set to an output or tied to VCC with a pull up. If you can use it as your CS pin then that should solve the problem. Its a feature of AVR hardware.

Of course if you're not using an AVR then it's something else.

WingNut
Posts: 254
Joined: Tue Jul 13, 2021 1:53 pm
Has thanked: 33 times
Been thanked: 23 times

Re: Macro file sd/sdhc bug

Post by WingNut »

Do you have an Sd card in the card holder? It won't initialise with out it present

BenR
Matrix Staff
Posts: 1739
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 440 times
Been thanked: 603 times

Re: Macro file sd/sdhc bug

Post by BenR »

With no card present you should get a return of 255 but it shouldn't cause a lockup in the init macro.

Mcolin
Posts: 11
Joined: Thu Aug 17, 2023 3:45 am

Re: Macro file sd/sdhc bug

Post by Mcolin »

Spi cs/ss is working well and correctly conected
IMG_20240318_020237.jpg
IMG_20240318_020237.jpg (86.61 KiB) Viewed 194 times
Last edited by Mcolin on Mon Mar 18, 2024 8:59 am, edited 1 time in total.

Mcolin
Posts: 11
Joined: Thu Aug 17, 2023 3:45 am

Re: Macro file sd/sdhc bug

Post by Mcolin »

Initialise sd macro can't step out to continue the flow.
In the example:
1.- an output begins with 0
2.-then the component macro "sd initialise"
3.-and at the end output change to 1 to turn on a led
IMG_20240318_022022.jpg
IMG_20240318_022022.jpg (101.04 KiB) Viewed 193 times
The led don't turn on, the initialise sd macro can't step out.
IMG_20240318_022107.jpg
IMG_20240318_022107.jpg (122.52 KiB) Viewed 193 times

Mcolin
Posts: 11
Joined: Thu Aug 17, 2023 3:45 am

Re: Macro file sd/sdhc bug

Post by Mcolin »

If disable sd initialise macro
IMG_20240318_022004.jpg
IMG_20240318_022004.jpg (99.66 KiB) Viewed 192 times
Led turns on so looks like sd macro initialise can't step out to work with sd module
IMG_20240318_022012.jpg
IMG_20240318_022012.jpg (107.33 KiB) Viewed 192 times

BenR
Matrix Staff
Posts: 1739
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 440 times
Been thanked: 603 times

Re: Macro file sd/sdhc bug

Post by BenR »

Hello,

Please change the CS pin of the SD component to pin D10 / PORTB.2, this should solve the problem.
CS_Pin.jpg
CS_Pin.jpg (26.7 KiB) Viewed 184 times

Please see my first post for an explaination.

Mcolin
Posts: 11
Joined: Thu Aug 17, 2023 3:45 am

Re: Macro file sd/sdhc bug

Post by Mcolin »

---> The CS pin of the SD component to pin D10 / PORTB.2 DON´T FIX THE PROBLEM
--> DEFAULT CLK PIN SETTINGS (CHANNEL 1) PORTB.5 DONT WORKS

THE PROBLEM WAS SOLVED IF:
CHANGE CLK PIN PORTB.5 ----> PORTB.0

SOLVED.png
SOLVED.png (356.2 KiB) Viewed 121 times

Post Reply