Try changing the value of
const bit SD_DELAY_AFTER_WRITE

Is there a write lock switch on the side of your card? Most likely not
since your using micro sd.

My MSD still needs work, but I'm getting closer. still not working so
well at the moment. I thought I was getting somewhere, but there have
been setbacks. If you do get SD card working, I'll give you my latest
MSD code. It doesn't support writes yet anyways.

Matt.

On Nov 6, 4:31 am, Sebastien Lelong <[email protected]>
wrote:
> 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.

Reply via email to