Shop OBEX P1 Docs P2 Docs Learn Events
Getting SD-MMC_FATEngine to work with ADC and SRAM on C3 — Parallax Forums

Getting SD-MMC_FATEngine to work with ADC and SRAM on C3

StephenMooreStephenMoore Posts: 188
edited 2011-10-03 20:56 in Propeller 1
My spin code bombs when I try to write data from the SRAM to the SD on my C3. The SD driver authors say the SPI select code was inserted afterwards. Has anyone verified use with LaMothes demo routines?

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2011-09-27 21:07
    Here's a modified version of Kye's SD card driver for the C3. It's not up to date, but does work.

    It should be able to coexist with other SPI routines as long as they select the desired device on each usage
  • StephenMooreStephenMoore Posts: 188
    edited 2011-09-27 21:24
    Excellent. You guys are great... datalogger here I come!
  • StephenMooreStephenMoore Posts: 188
    edited 2011-09-27 21:36
    actually after compiling... C3 have no RTC. Needs some more tweaking but I like the SPI asm stuff.
  • Mike GreenMike Green Posts: 23,101
    edited 2011-09-27 21:37
    There's also a C3 version of FemtoBasic that supports the ADC, SRAM, FLASH, as well as the usual FemtoBasic features including a FAT16 SD card.
  • StephenMooreStephenMoore Posts: 188
    edited 2011-09-30 20:50
    Hi Mr Green:

    It's me again. If you read this I am still having trouble with integrating SD drivers and the C3 SPI select feature. If I use SPI_Init then the SPI driver in the SD asm code bombs and I can not mount the card. If I do not use SPI_Init then I can not access the AD chip using SPI_Select. Somehow the pin I/O state is being redefined by one or the other drivers and they do not play well together. I am trying to write a very lean custom application and am getting frustrated. Thank you for the femtoBASIC code too.

    SM
  • Mike GreenMike Green Posts: 23,101
    edited 2011-09-30 21:17
    You can use the drivers from C3 FemtoBasic (fsrwFemto.spin, sdspiFemto.spin, and Winbond_Driver.spin). They're designed to play together and be used from other software. Winbond_Driver has routines for accessing the SRAM and ADC as well as the flash memory. You can look at how FemtoBasic calls them.
  • StephenMooreStephenMoore Posts: 188
    edited 2011-10-03 20:56
    Mr. Green:

    Hello again.

    I have had some success with femtoBasic drivers... my C3 doesn't lock up when I access the ADC with a mounted SD!

    However, I am getting garbage out of the MCP3202. Applying sglDiff = TRUE and oddSign = TRUE (single ended Channel 1) gives wild numbers coming back. The conversions are normal with La Mothe's ADC demo. I have an LM34 thermometer attached so it is a pretty simple setup.

    The MCP3202 datasheet shows the converted 12 bit data ( plus one leading null bit ) coming back as soon as the the last bit of the 4-bit command is received. Any ideas regarding timing in the Winbond_Driver asm?

    Regards,

    SM
Sign In or Register to comment.