Shop OBEX P1 Docs P2 Docs Learn Events
mcp2515 spi timing — Parallax Forums

mcp2515 spi timing

jrmorganjrmorgan Posts: 2
edited 2007-11-25 06:29 in BASIC Stamp
I am having problems getting the spi to work a mcp2515 CAN controller. i dont have a bs2 right now on the bench so i was using a bs1 which needs a different approach to spi. The datasheet says the data output is valid from clock low a max of 45 nanosecs. 2 questions:

does the bs2 command SHIFTIN have faster timing to handle this?

any ideas to get the bs1 to work?

thanks

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2007-11-25 06:29
    The BS2 SHIFTIN sets the clock line to low, then generates short (14us) positive going pulses with about 46us between pulses (see the Basic Stamp Manual for details under SHIFTIN/SHIFTOUT). It can sample the data line before (PRE) the clock pulse or after (POST) the clock pulse. Without the datasheet, I can't tell whether the PRE mode will work. The POST mode won't work from your description of the timing.

    The BS1 doesn't have the SHIFTIN/SHIFTOUT statements and is much slower than the BS2. There are several Nuts and Volts columns as well as other application notes on using the BS1 with various SPI devices. It basically uses the HIGH and LOW statements or TOGGLE statement to produce the clock and samples the data I/O pin during the proper phase of the clock. It's very slow. An SPI byte transfer takes 12 to 15ms at best since the BS1 only executes 2000 interpretive codes per second.
Sign In or Register to comment.