Coding and general discussion relating to user created compiler modules
Moderators: David Barker, Jerry Messina
-
dman776
- Posts: 115
- Joined: Mon May 28, 2007 3:59 pm
- Location: Texas
Post
by dman776 » Fri Mar 07, 2008 5:03 am
I am testing in SW mode and is complaining about this Sub...
Code: Select all
Sub ReInitSPIPort()
SSPControl1 = SPISpeed Or %00100000 // Setup MSSP module & turn on
SSPStatus = %01000000
End Sub
SSPControl1 and SSPStatus are only defined if using MSSP.
It looks like you need the following....
Code: Select all
Sub ReInitSPIPort()
#if SD_SPI in (MSSP)
SSPControl1 = SPISpeed Or %00100000 // Setup MSSP module & turn on
SSPStatus = %01000000
#endif
End Sub
-
dman776
- Posts: 115
- Joined: Mon May 28, 2007 3:59 pm
- Location: Texas
Post
by dman776 » Fri Mar 07, 2008 5:08 am
It also seems to not like a 40Mhz HSPLL clock.
It init's and starts a few reads but then errors out. If I clock it down to 10Mhz, all is well.
-
Steven
- BETA Tester
- Posts: 406
- Joined: Tue Oct 03, 2006 8:32 pm
- Location: Cumbria, UK
Post
by Steven » Fri Mar 07, 2008 7:21 am
Thanks very much for that - the suggested fix is perfect. I've added it to my module and will republish it soon anyway, hopefully with multiple file support.
As for the 40MHz clock, I've tested extensively with 40MHz PLL in MSSP mode and all is OK, but it may be down to the card or the length of your connections to the card socket? If max speed isn't an issue, then 10MHz is probably safer anyway.
Steve