Shop OBEX P1 Docs P2 Docs Learn Events
First C3 question? — Parallax Forums

First C3 question?

RavenkallenRavenkallen Posts: 1,057
edited 2011-01-14 10:48 in Propeller 1
Hey all. I just got my C3 in the mail and i have been playing around with it since... I just connected usb and a tv and the demo popped right up. I then played some of the demo games and it worked flawlessly. It seems really cool so far...Only one thing is confusing me, and that is the SPI interface. I know other programs will run on the C3 with a little work, but i don't really how to go about doing it. Like how would one use FSRW with the C3? Would you need to add some code at the beginning of a program to make it select the right SPI channel? I have read the Unleashing the C3 e-book and Andre did a good job, but i still can't wrap my head around the SPI channel select concept. I also assume that one has to change the spi channel every time the program wants to use a different peripheral? ...I look forward to using the C3 a lot more. Thanks for the help:)

Comments

  • JonnyMacJonnyMac Posts: 9,208
    edited 2011-01-13 19:01
    In most programs the CS line is directly controlled; they'll have to be changed for the C3. For example, to select the SD card on the C3 you have to make this call:
    SPI_Select_Channel( 5 )
    

    I think Andre has provided an SD card driver for the C3; you might check the files folder for it. Better to use code that's been pre-tested on the platform.
  • David BetzDavid Betz Posts: 14,516
    edited 2011-01-13 19:21
    You can try the driver I use with my port of ZOG to the C3. It's been hacked to use the C3 SPI select code.
  • RavenkallenRavenkallen Posts: 1,057
    edited 2011-01-13 20:33
    WHOOOOO!!!!!!!!! I figured it out. The CS of the SPI device is activated from the multiplexer which is advanced by the counter...It was so obvious. I just had to read the instructions a little better. Here is the C3 compatible SD trainer with FSRWfemto and a custom object copied from the E-book to control the spi bus... Thanks everybody!!
  • AndreLAndreL Posts: 1,004
    edited 2011-01-13 21:46
    And of course, I have written in detail EVERY single aspect of the C3, so if there is anything you want to figure out, just read the manual. EVERYTHING is there -- I spent a good 250-300 hours writing that manual and developing all the demos that go with it, so please everyone read it :)

    Andre'
    p.s. Also, many drivers that use SPI protocol seem to have little bugs where they don't release the chip select, or drop a line back down to 0, etc. but, things worked out since the CS logic is a single line. On the C3 however, when you port these apps, these bugs get uncovered, so be careful that you follow SPI protocol and if some object doesn't work even after you put the code to properly select the SPI chip on the C3 then chances are there is a bug in it, but just happens to work. We found this problem with some of the SD drivers for example from the object exchange -- so just be careful :)
  • RavenkallenRavenkallen Posts: 1,057
    edited 2011-01-14 10:48
    Yeah, sorry.. I kind of get ahead of myself and freak out when something doesn't work right away. I often find that i just need to calm down and think about it logically. Andre has done a superb job and he deserves a lot of credit for his time/work...Three cheers for Andre!!!!!
Sign In or Register to comment.