Author Topic: PIC18F45K50 and FATFS help  (Read 3687 times)

0 Members and 1 Guest are viewing this topic.

Offline ColdKeyboardTopic starter

  • Contributor
  • Posts: 33
  • Country: ca
    • Sasa Karanovic
PIC18F45K50 and FATFS help
« on: March 25, 2015, 03:58:37 am »
I've bee trying to compile FATFS and PETITFS for PIC18F45K50 with XC8 compiler but with no luck :\

Only thing I got working is this poor example that must have filename size of 8 characters and all lines need to be 32 characters long :\

I want to create a .txt file on the SD card (if it doesn't exist) and append data to it. Pretty much that's it.

There are examples for PIC24F and PIC32 but I couldn't make them work on my mcu :\

Does anyone have a suggestion how to implement fatfs and low-level IO functions or even better, have a SD card library that will work with this MCU and XC8?
I share most of my work at sasakaranovic.com
Also you can follow me @Twitter, @Facebook or contact me on Skype
 


Offline BloodyCactus

  • Frequent Contributor
  • **
  • Posts: 482
  • Country: us
    • Kråketær
Re: PIC18F45K50 and FATFS help
« Reply #2 on: March 25, 2015, 04:25:43 pm »
2k ram is not a lot of space for working with a FAT filesystem (that includes your own data variables etc inside that 2k)...

but still should be able to walk the FAT and open file/write it out if you strip out a lot of the cruft and stuff.
-- Aussie living in the USA --
 

Offline ColdKeyboardTopic starter

  • Contributor
  • Posts: 33
  • Country: ca
    • Sasa Karanovic
Re: PIC18F45K50 and FATFS help
« Reply #3 on: March 25, 2015, 04:32:33 pm »
Have you tried microchip library for PIC18?
check this library here WWW.SecureSoftwareList/secsoftwaredownload.aspx?device=en537999&lang=en&ReturnURL=http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=2680&dDocName=en537999#]http://www.microchip.com/Microchip.WWW.SecureSoftwareList/secsoftwaredownload.aspx?device=en537999&lang=en&ReturnURL=http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=2680&dDocName=en537999#[/url]


In newer microchip libraries they support PIC24 and PIC32, there is no support or examples for PIC18 :\ At least I didn't find any. In older versions there are but it's for C30 and not for XC8.

2k ram is not a lot of space for working with a FAT filesystem (that includes your own data variables etc inside that 2k)...

but still should be able to walk the FAT and open file/write it out if you strip out a lot of the cruft and stuff.

2K ram is really small footprint, are you talking about FATFS or some other FS?

Does anyone have examples for PIC18 or even better working examples for PIC18F45K50 or some other similar mcu :)
I share most of my work at sasakaranovic.com
Also you can follow me @Twitter, @Facebook or contact me on Skype
 

Offline BloodyCactus

  • Frequent Contributor
  • **
  • Posts: 482
  • Country: us
    • Kråketær
Re: PIC18F45K50 and FATFS help
« Reply #4 on: March 25, 2015, 07:27:16 pm »
2k ram is not a lot of space for working with a FAT filesystem (that includes your own data variables etc inside that 2k)...

but still should be able to walk the FAT and open file/write it out if you strip out a lot of the cruft and stuff.

2K ram is really small footprint, are you talking about FATFS or some other FS?

Does anyone have examples for PIC18 or even better working examples for PIC18F45K50 or some other similar mcu :)

I'm talking that your PIC18F45K50  has only 2k of RAM. thats a very small foot print to parse and walk the FAT. doable but going to be very cramped. giving the PIC18F45K50 also has very tiny tiny code space, you dont have much room for the FAT code in there.
-- Aussie living in the USA --
 

Offline sca

  • Regular Contributor
  • *
  • Posts: 68
Re: PIC18F45K50 and FATFS help
« Reply #5 on: March 25, 2015, 10:50:15 pm »
It ought to fit, looking at the memory usage table in the fatfs docs.

One potential thing to look out for. I did this some years back on an 18f6550 iirc, using the hi-tech compiler pro version. It caused substantial amounts of pain, due to the compiler producing bad code for (iirc) a rather nasty double dereference inside a conditional. I ended up splitting into two separate lines of code and it worked fine. It took a *lot* of finding.

I think the xc8 compiler is based on the hi-tech code so this may still be relevant.

I tried to report to Microchip at the time but they wouldn't  investigate without a smaller example and I didn't  have time to produce one.



sca
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf