This isn't going to help much, but you are most likely getting stuck
in this procedure (in sd_card.jal)
--------------------------------------------------------------------------------
-- read 1 bytes from the sd card (pseudo var)
--------------------------------------------------------------------------------
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
sd_byte_count = sd_byte_count + 1 -- increment byte_count
if sd_byte_count == SD_BYTE_PER_SECTOR then -- end of
sector read
sd_byte_count = 0
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
return data_byte
end function
At this loop:
while spi_master != 0xFE loop -- wait till data is ready to
read
end loop
This of course doesn't make much sense since you are able to use the
same procedure in the sd card sample.
So... I suggest you go back to sd_card.jal and try to read a larger
number of sectors to see if you get stuck. If you do get stuck, maybe
you can tell me how many sectors you can read before getting stuck. A
sector is 512 bytes, in the below example you will read 50 sectors.
--------------------------------------------------------------------------------
-- EXAMPLE #2 write to a sector 1 byte at a time
--------------------------------------------------------------------------------
...
...
-- read the data back
sd_start_read(20)
for 512*50 loop -- changed this line
data = sd_data_byt
serial_write(data)
end loop
sd_stop_read()
I now assume it is a sd card issue, and not a fat32 issue.
Matt.
On Nov 24, 5:23 pm, YoBe <[email protected]> wrote:
> On 24 nov, 19:29, mattschinkel <[email protected]> wrote:
>
> > Are you able to find where your program gets stuck in
> > fat32_small_init() ?
>
> > Matt.
>
> Hi Matt,
>
> I found where it stucks. But realy on a strange moment:
> I used the serial feedback to see when it stops:
>
> This procedure is started:
>
> procedure fat32_small_read_boot_sector() is
> var dword sec_per_fat
> var byte _sec_per_fat[4] at sec_per_fat
> var word reserved_sectors
> var byte _reserved_sectors[2] at reserved_sectors
> var dword partition_lba_begin = 0
>
> serial_hw_data = 70 ;F
> fat32_small_start_read(0)
> serial_hw_data = 71 ; G
> fat32_small_read_pulse_byte(47) => when calling this
> procedure is does not come back
>
> But when calling "fat32_small_read_pulse_byte(47)" it never comes
> back.
> If I then go to SD-Card lib, the Pic stops at this point (I receive
> the letter "H" on my serial, but never "I"). This is realy strange for
> me.
>
> --------------------------------------------------------------------------------
> -- send a read pulse to the sd card, go 1 bytes forward in current
> sector.
> --------------------------------------------------------------------------------
> procedure sd_read_pulse_byte(word in count1) is
> serial_hw_data = 72 ; H
> var byte x
> for count1 loop -- loop specified number of times
> x = sd_data_byte -- do a data read and ignore the
> incomming data
> end loop
> serial_hw_data = 73 ; I
> end procedure
--
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.