Hi Seb,

Could it be there is a bad block (not sure if this is possible)? If
so, Windows probably is able to cope with that and your code isn't?

I created sd-card read/write procedures back in 2005 and recall having
a problem with a particular block. In the end I was able to resolve
it. Don't recall what the problem was, but do know recognising the
code failed on a particular block was key in resolving it.

Joep


2011/11/6 Sebastien Lelong <[email protected]>:
> Hi Matt, guys,
> I'm having a really weird problem with SD-card on my jaluino bee board.It
> used to work but not anymore, though same hardware and same software (backup
> HEX file that was working).
> Here's the story...
> I built a new Bee board, using 18f25K22 instead of 18F27J53. When I tried to
> test sd card it didn't work. Note I programmed 25K22 using pickit2, with
> SD-card plugged, while Vpp = 11/12V (IIRC). 27J53 uses 3V3 as Vpp, no harm
> to the card can be done... My try didn't work, can't write/read to Sd-Card.
> I tried back on the Bee board, on which I knew it was working. Now it didn't
> work at all. I thought I damaged the card with bad voltage, but Windows is
> happy use it, format it, read and write to it. So I'm not sure it's actually
> damaged.
> Still, using the exact same hardware (I rechecked connection just in case:
> OK), the exact same software (HEX I preciously saved), no luck anymore...
> I tried to track down where it fails. It seems it can't terminate/close a SD
> sector. The calling code is the following:
>    sd_start_write(20)         -- get sd card ready for write at sector 20
>    for 512 + 256 loop         -- loop 1 sector + 1 half sector (512 + 256
> bytes)
>
>      print_string(serial_hw_data,writing)
>      print_byte_dec(serial_hw_data,counter)
>
>      sd_data_byte = counter   -- write 1 bytes of data
>
>      print_string(serial_hw_data,written)
>      print_crlf(serial_hw_data)
>
>      counter = counter + 1
>    end loop
> It actually says it's writing, until the 512th byte, that is, end of SD card
> sector. On the last failing call, sd_data_byte'put gets stuck in the
> following while loop:
>
> procedure sd_data_byte'put(byte in data_byte) is
>   [...]
>   if sd_byte_count == SD_BYTE_PER_SECTOR then -- end of sector write
>       serial_hw_data = "s"
>       sd_byte_count = 0
>       sd_sector_count = sd_sector_count + 1 -- increment sector count
>       spi_master = 0xFF  -- send junk crc, crc is disabled
>       spi_master = 0xFF  -- send junk crc, crc is disabled
>       x = spi_master   -- wait for a response
>       while x == 0 loop
>          serial_hw_data = "."
>          x = spi_master
>       end loop
>
> It just prints "." indefinitely...
> Do you guys have any idea of the current problem ? Could the card be damaged
> and still Windows being to use it ?
> I'm afraid I don't have another card to test...
> TIA
> Cheers,
> Seb
>
> --
> 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.
>

-- 
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