• AVR Freaks

AnsweredHot!PIC18F4550 - SPI - MCP2515 baud rate

Author
danbakana
Junior Member
  • Total Posts : 107
  • Reward points : 0
  • Joined: 2012/08/27 05:21:28
  • Location: 0
  • Status: offline
2019/07/17 08:19:49 (permalink)
0

PIC18F4550 - SPI - MCP2515 baud rate

I'm using PIC18F4550 and a MCP2515 CAN controller. On the PIC18F4550's datasheet says that SPI allows a maximum data rate (at 48 MHz) of 2.00 Mbps.
 
• FOSC/4 (or TCY)
• FOSC/16 (or 4 . TCY)
• FOSC/64 (or 16 . TCY)
 
1) This 48 MHz is the Fosc ( the frequency of the external crystal ) ?
2) I'm using a 16MHz external crystal, can I reach up to at least 1MHz at SPI ?
3) I know I can configure the MCP2515 baud rate, but, is there a direct relation between frequency SPI of PIC18F4550 and the baud rate of MCP2515 ? (Of course, if the SPI is too slow and the CAN too fast, I can have problems, but my CAN messages has big intervals of miliseconds of each other)
#1
mbrowning
USNA79
  • Total Posts : 1795
  • Reward points : 0
  • Joined: 2005/03/16 14:32:56
  • Location: Melbourne, FL
  • Status: offline
Re: PIC18F4550 - SPI - MCP2515 baud rate 2019/07/17 08:42:07 (permalink) ☼ Best Answerby danbakana 2019/07/23 10:29:05
+1 (1)
Fosc is the CPU clock, whether from external, internal, PLL, whatever.
At 48MHz (max Fosc), Fosc/4 is 12MHz for SPI clock. It might be difficult to sustain 12Mbps because there are only 8 instruction cycles (Instruction clock is fixed at Fosc/4) per byte at that rate, but certainly more than 1Mbps.
 
I've not looked closely at the MCP2515 datasheet, but the SPI and CAN bit rates are surely independent.
#2
laoadam
New Member
  • Total Posts : 3
  • Reward points : 0
  • Joined: 2019/03/16 13:31:39
  • Location: 0
  • Status: offline
Re: PIC18F4550 - SPI - MCP2515 baud rate 2020/01/18 04:40:29 (permalink)
0
Hi,
May I hang a question here?
If use a 8MHZ or a 16 MHZ external crystal for MCP2515, what can be the difference on MCP2515 .cpp's configuration?
Thanks
Adam 
 
#3
Jump to:
© 2020 APG vNext Commercial Version 4.5