• AVR Freaks

AnsweredECAN - Help with new project for newbie - CAN programming

Author
ThomasDowling
New Member
  • Total Posts : 5
  • Reward points : 0
  • Joined: 2019/12/02 16:07:10
  • Location: 0
  • Status: offline
2019/12/03 05:31:19 (permalink)
0

ECAN - Help with new project for newbie - CAN programming

Hey guys,
 
So, i'm part of the formula student at my university and they gave me the job to do the whole acquisition data. 
The thing is, I didn't know anything about electronics before.
I did some research and I manage to learn lots of new things, such as filters, ADC, type of microcontrollers, what is CAN, and I downloaded some books so they can help me with the programming. On my first day of the university, I didn't know what was a capacitor used for.

Here is where I got confused.
 
My project consists on receiving the information on the BMS and the inverter via CAN and, with an SPI (NRF24L01+), communicate via Wireless with another board that i'm designing myself and show all the information of the BMS and the Inverter of the vehicle on an interface on my pc. I did the 2 bus, separated by a resistance of 120Ohms, but... I'm having trouble in the software, at receiving the information. I don't know how to do that at all, and nobody here at the university knows too, not even the teachers.

My microcontroller is a PIC18f46k80, connecter with a normal transceiver (MCP2551). I have the IDs on the datasheet, but software speaking, how can I make this work?

I have basic knowledge of programming a pic.
 
Thank you in advance.

Thommy Dowling
 
#1
Lurch
Super Member
  • Total Posts : 645
  • Reward points : 0
  • Joined: 2010/08/04 14:05:04
  • Location: 0
  • Status: offline
Re: ECAN - Help with new project for newbie - CAN programming 2019/12/03 10:38:56 (permalink) ☼ Best Answerby ThomasDowling 2019/12/03 10:42:07
0
Look at the code examples on Microchip's website. There's one for polling mode. I think it was for 18F4685, but the source code will work on 18F46K80. Use that as a starting point.
(edit: AN878 - PIC18C ECAN C Routines)
post edited by Lurch - 2019/12/03 10:42:06
#2
ThomasDowling
New Member
  • Total Posts : 5
  • Reward points : 0
  • Joined: 2019/12/02 16:07:10
  • Location: 0
  • Status: offline
Re: ECAN - Help with new project for newbie - CAN programming 2019/12/03 11:09:16 (permalink)
0
Hey! Thank you for you fast response

But that code means nothing to me, since I can't understand it

As I said, I have little knowledge of programming a PIC, and I was wondering if there is a sep-by-sep on how to do it. :(

Thank you in advance
#3
NKurzman
A Guy on the Net
  • Total Posts : 18061
  • Reward points : 0
  • Joined: 2008/01/16 19:33:48
  • Location: 0
  • Status: offline
Re: ECAN - Help with new project for newbie - CAN programming 2019/12/03 11:30:15 (permalink)
0
1. DO not use acronyms unless you are sure your audience know them is BMS a Battery Management system? 
"The Inverter"  "The vehicle"  things know to you.  If this is not some thing you made your self there will be a Protocol running on top of the CAN Bus Hardware.  And there are a lot of possibilities. Some are Proprietary You need to know.
The Low level set up you may be able to get from MCC or the Data Sheet. 
#4
katela
Super Member
  • Total Posts : 1469
  • Reward points : 0
  • Joined: 2013/06/11 05:25:18
  • Location: South Africa
  • Status: online
Re: ECAN - Help with new project for newbie - CAN programming 2019/12/03 14:38:39 (permalink)
0
ThomasDowling
But that code means nothing to me, since I can't understand it

As I said, I have little knowledge of programming a PIC, and I was wondering if there is a sep-by-sep on how to do it. 



They won't be any shortcut, usually before you attempt advanced peripherals like the CAN bus, you should at least understand the basics first. Be able to blink an LED, use the USART etc.
You can start with this Microchip video: Set up CAN in Minutes Using MPLAB® Code Configurator, they are using a 16-bit MCU but you can get an understanding how you can do it with MCC. 
Follow the steps in this Application note AN2714.
 
 

Free online Microcontroller Tutorials and Projects for Hobbyists and students. From beginners to advanced. Website: www.studentcompanion.co.za
YouTube Tutorials: https://www.youtube.com/StudentCompanionSA
#5
Jump to:
© 2019 APG vNext Commercial Version 4.5