Page 1 of 1

SD card not initialising using 18F47K42 FC9

Posted: Tue Apr 02, 2024 1:36 pm
by howard123
Morning all

I have been using the PIC18F47K40 and have had the SD card working without a problem. On changing to the PIC18F47K42 the SD card does not pass the initialise component macro.

The code is identical between the two devices mentioned as are the pins, the clock frequency, the initial pre-scaler and the high speed pre-scaler.

The clock at the time of the card initialisation is 8 meg and the pre-scaler is f/64 which gives 125kHz to the card.

I have checked that all other pins used have been correctly allocated and have seen this problem on more than one PIC18F47K42

Any ideas?
Thanks Howard
FC9

Re: SD card not initialising using 18F47K42 FC9

Posted: Tue Apr 02, 2024 2:09 pm
by medelec35
Hello.
Are you referring to a compiler error with just initialise, if so can you post your .fcfx, .c and .msg.txt files please.

Or are you referring to stuck on initialise within your hardware?

Re: SD card not initialising using 18F47K42 FC9

Posted: Thu Apr 04, 2024 12:34 pm
by howard123
Hello Martin

The hardware hangs at the point of initialisation.

I have done a sanity check by going back to the PIC18F47K40 and this does initialise and record in the main loop, using the same SD card.

Re: SD card not initialising using 18F47K42 FC9

Posted: Thu Apr 04, 2024 8:39 pm
by medelec35
In that case can you try software mode instead.
The issue with 18FxxK42 devices is some of the SFR are different to the norm, so they are not currently supported with SPI or I2C.
The rules have been completely rewritten!
Sorry for any inconvenience.

Re: SD card not initialising using 18F47K42 FC9

Posted: Sat Apr 06, 2024 9:18 am
by howard123
Thanks I will give that a go and let you know if it works.

Re: SD card not initialising using 18F47K42 FC9

Posted: Sun May 12, 2024 2:10 pm
by howard123
Again thanks, this has worked. Some points to note are that on this chip when using the software I2C the slew rate control must be on and when using the software SPI the slew rate control must be off.