Page 1 of 1
					
				Macro file sd/sdhc bug
				Posted: Tue Mar 05, 2024 6:35 am
				by Mcolin
				Component macro
 filesd::initialise()
Don't step out on real hardware running.
			
		
				
			
 
						- IMG_20240305_000925.jpg (80.06 KiB) Viewed 6959 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 
			 
			
					
				Re: Macro file sd/sdhc bug
				Posted: Tue Mar 05, 2024 8:35 am
				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.
			 
			
					
				Re: Macro file sd/sdhc bug
				Posted: Tue Mar 05, 2024 8:56 am
				by WingNut
				Do you have an Sd card in the card holder? It won't initialise with out it present
			 
			
					
				Re: Macro file sd/sdhc bug
				Posted: Tue Mar 05, 2024 10:11 am
				by BenR
				With no card present you should get a return of 255 but it shouldn't cause a lockup in the init macro.
			 
			
					
				Re: Macro file sd/sdhc bug
				Posted: Mon Mar 18, 2024 8:37 am
				by Mcolin
				Spi cs/ss is working well and correctly conected
			
		
				
			
 
						- IMG_20240318_020237.jpg (86.61 KiB) Viewed 6881 times
 
		
		
		
			  
			 
			
					
				Re: Macro file sd/sdhc bug
				Posted: Mon Mar 18, 2024 8:54 am
				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 (101.04 KiB) Viewed 6880 times
 
		
		
		
			 
The led don't turn on, the initialise sd macro can't step out.
			
		
				
			
 
						- IMG_20240318_022107.jpg (122.52 KiB) Viewed 6880 times
 
		
		
		
			  
			 
			
					
				Re: Macro file sd/sdhc bug
				Posted: Mon Mar 18, 2024 8:58 am
				by Mcolin
				If disable sd initialise macro
			
		
				
			
 
						- IMG_20240318_022004.jpg (99.66 KiB) Viewed 6879 times
 
		
		
		
			 
Led turns on so looks like sd macro initialise can't step out to work with sd module
			
		
				
			
 
						- IMG_20240318_022012.jpg (107.33 KiB) Viewed 6879 times
 
		
		
		
			  
			 
			
					
				Re: Macro file sd/sdhc bug
				Posted: Mon Mar 18, 2024 10:09 am
				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 (26.7 KiB) Viewed 6871 times
 
		
		
		
			 
Please see my first post for an explaination.
 
			 
			
					
				Re: Macro file sd/sdhc bug
				Posted: Sat Mar 30, 2024 7:00 am
				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 (356.2 KiB) Viewed 6808 times