For those that have used the MCP2515

Go To Last Post
3 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi - I'm looking at using an MCP2515 in an upcoming circuit. It seems fairly straightforward - but there's one little thing I'm worried about. I'm planning on using an ATMEGA48. I'm running pretty low on GPIOs so I figured I could connect a 20mhz crystal to the MCP2515 and then use its CLKOUT pin to drive XTAL1 on the ATMEGA48. I plan on programming the ATMEGA48 both initially and periodically with an AVRISP (I'm sure glad I have a spare now that they're no longer made!!!). Also - the MCP2515 and the AVRISP will be sharing the SPI, so I understand I need resistors inline with the MCP2515. I was thinking I'd just put 1Ks there to start with and see if that worked ok. Any idea how to calculate the value for that resistor?

Anybody see any problems with this plan? I need to be able to do both the initial and final programming on this board (as the ATMEGA48 is a TQFP).

Thanks!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Firstly I think you need a 16MHz clock for the MCP2515. You might get it to work at a non-standard rate, or you may be able to fiddle the divisors to get a standard rate, but unless you need the extra speed for the AVR I would use 16MHz.

I would also have the clocks the opposite way around from what you said: Have a crystal on the AVR and use the CLKO pin to provide a clock for the MCP2515. The MCP2515 powers up with a /8 divisor between the clock and clock out pin (can change over SPI) but I wouldnt want to rely on the AVR accepting a change from 2MHz to 16MHz while running.

Hope that helps!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Py wrote:
Firstly I think you need a 16MHz clock for the MCP2515. You might get it to work at a non-standard rate, or you may be able to fiddle the divisors to get a standard rate, but unless you need the extra speed for the AVR I would use 16MHz.

I would also have the clocks the opposite way around from what you said: Have a crystal on the AVR and use the CLKO pin to provide a clock for the MCP2515. The MCP2515 powers up with a /8 divisor between the clock and clock out pin (can change over SPI) but I wouldnt want to rely on the AVR accepting a change from 2MHz to 16MHz while running.

Hope that helps!


Where are you getting 16MHz? I looked through the MCP2515 datasheet fairly carefully and I couldn't find any reccomendations for clock speed. On Page 54, though, it reccomends capacitor sizes for 4, 8, and 20MHz crystals, so I assumed that was an allowed speed. I really would prefer to stick with 20MHz though, mostly because I don't know what speed I need just yet - so I'm maxing everything out for maximal performance.

The /8 divisor, along with the switchover from 20/8 to 20 mhz, is one of my big worries. To me it would seem that the AVR would keep on running just fine, only things that were dependent on the clock speed would mess up (UART, SPI, TWI, timers, etc.) But those all could be easily reset for the new clock speed. But I'm really not sure - I've never switched up the speed of the oscilator like that.