Hi Matt,

BTW, I found some potential issue, or at least waste of code in sd_card.jal
lib:

Here's the guilty function:

---
function sd_data_byte'get() return byte is
   var byte x, data_byte

   if sd_byte_count == 0 then               -- beginning of sector read
      while spi_master != 0xFE loop      -- wait till data is ready to read
      end loop
   end if

   data_byte = spi_master                -- get data byte

   if sd_byte_count == 512 then             -- end of sector read
      sd_sector_count = sd_sector_count + 1 -- increment sector number
      x = spi_master                     -- get junk crc data, crc is
disabled
      x = spi_master                     -- get junk crc data, crc is
disabled
   end if

   sd_byte_count = sd_byte_count + 1 -- increment byte_count
   if sd_byte_count == 512 then
      sd_byte_count = 0
   end if

   return data_byte
end function
---

When sd_byte_count = 511:
  - enter the function
  - you read data from spi
  - sd_byte_count is incremented, now is 512
  - since it's 512, it then sets to 0 (last "if")

As a consequence:

   if sd_byte_count == 512 then             -- end of sector read
      sd_sector_count = sd_sector_count + 1 -- increment sector number
      x = spi_master                     -- get junk crc data, crc is
disabled
      x = spi_master                     -- get junk crc data, crc is
disabled
   end if


nerver gets executed.

Am I right ?

Cheers,
Seb


2011/5/2 Sebastien Lelong <[email protected]>

> Hi Matt,
>
> Thanks for your effort, but this is still the same, fat32 get stuck within
> init procedure. I guess this is due to my fat32 partition, something is
> wrong with it. Included is an partial hexdump of my partition, showing
> content but only when changing. Format is:
>
> address  b1 b2 b3 b4 b5 b6 b7 b8  b9 b0 b1 b2 b3 b4 b5 b6  |ascii ascii
> asci|
>
> (b0 is b10, then b1 is b11, etc...)
>
> If content didn't change, you'll get "*"
>
> If you have time (and only if), you might be able to what's going on by
> looking at addresses and content in order to see if data is wrong or not.
> Careful: there may be data residues from previous experiments (but you
> should be able to read important sectors in fat32)
>
> TIA
> Cheers,
> Seb
>
>
> 2011/5/2 mattschinkel <[email protected]>
>
>> Seb, I finally found time to fix the FAT32_SMALL cluster size issue.
>> Give it a try!
>>
>> Matt.
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"jallib" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/jallib?hl=en.

Reply via email to