Making Arduino talk to another MicroController (learning circuit)

Hello, I bought an MCU with CAN capability and I think I may have bit on more than I can chew.

I want to make a learning circuit where I take an MCU, in this case its - PIC18F458

PIC18F458 (datasheet here)

and write/extract eeprom to it using arduino.

Is this a lot easier than it seems because reading the data sheet made my head spin.

Thanks!

Do you have a specific need for CAN ?

You can simply use Arduino to Pic via their serial ports by a direct wire* connection if the distance is under 1 mtr or via a Max232 chip if longer.

  • with a series 1K resistor in both the tx and rx serial lines.

What language are you going to use to program the Pic chip ?

You have a suitable hardware programmer for the Pic chip ? they are not like the Arduino usb bootloader unless you hardware program one in first.

I'm not quite sure where to start.

You understand that you can not use the Arduino IDE to program the PIC? You need a different development environment for the PIC.
2)
Is the CAN part relevant? Do you want to communicate using the CAN bus?
3)
What do you mean by write/extract eeprom? The eeprom that stores some data (just like the most Arduinos have some eeprom memory) or the program memory?
4)
If (3) is indeed eeprom: I don't have experience with CAN. But you can connect the PIC uart pins to the Arduino uart pins or us SPI interface and achieve what you want to achieve.

Lastly, what is a 'learning circuit'?

I ultimately want to make a CAN shield that I can use to interface with a vehicle network. I called this a learning circuit because I am hoping to learn from this.

The PIC has some eeprom, I would like to read/write from it. Similar to the memory Arduino has.

If (3) is indeed eeprom: I don't have experience with CAN. But you can connect the PIC uart pins to the Arduino uart pins or us SPI interface and achieve what you want to achieve.

I think this is what I am leaning towards, using the serial I/O. Do I just put a wire connecting the TX/RX lines with a 1k resister on each line like Ricky101 said in the first post?

Assume you are wanting to use the Pic chip as the 'CAN' device and interrogate it from your Arduino ?

You might find the links and info on this old post of interest /help.

I also write simple code on the pic18F chips if you need help there, though have never used CAN.

I am not dealing with CAN at the moment, just getting acclimated to using another MCU. I am focusing on just reading/writing to and from the arduino to the PICs EEPROM. Can you lay out the steps I need to accomplish this task?

I found this in the PIC programming manual.

4-Bit
Command
Data Payload Core Instruction
Step 1: Direct access to data EEPROM.
0000
0000
9E A6
9C A6
BCF EECON1, EEPGD
BCF EECON1, CFGS

Wouldn't it be a lot easier to use two Arduinos rather than an Arduino and a PIC?

Have you Googled Arduino canbus?

...R

Robin2:
Wouldn't it be a lot easier to use two Arduinos rather than an Arduino and a PIC?

Have you Googled Arduino canbus?

...R

I am sure it would be easier but that would defeat the purpose of learning.

Georgeduino:
I am sure it would be easier but that would defeat the purpose of learning.

I guess I have not yet figured out what it is you are trying to learn?

I have the impression that you are trying to learn how to communicate with a Canbus?

...R

Georgeduino:
I am not dealing with CAN at the moment, just getting acclimated to using another MCU. I am focusing on just reading/writing to and from the arduino to the PICs EEPROM. Can you lay out the steps I need to accomplish this task?

I found this in the PIC programming manual.

4-Bit
Command
Data Payload Core Instruction
Step 1: Direct access to data EEPROM.
0000
0000
9E A6
9C A6
BCF EECON1, EEPGD
BCF EECON1, CFGS

Can you provide a link to that programming manual? And preferably the chapter / page in there where you got the above data from?

I can see two possibly ways to access the eeprom of the PIC. The first one is to write a program for the PIC that communicates with the Arduino; Arduino sends command, PIC interpretes and gives some data back. The second way might be to directly access it using some kind of programmer and the Arduino will be your programmer in that case.

Which way do you visualize?

Sterretje, I am trying to do the latter with Arduino as the programmer.

To give you a better background why I am doing this.

This is for a digital forensics class I am working on a project to extract memory from a device.

The PIC (44pin TQFP) had some data stored on EEPROM and I am trying to get it out. Therefore I am not trying to program, just access the EEPROM function.

Based on the programming documentation I have, The pin for the PIC are:

MCLR/VPP VPP P Programming Enable (pin 18)
VDD VDD P Power Supply (pin 7,28)
Vss VSS P Ground (pin 6,29)
RB6 SCLK I Serial Clock (pin 39)
RB7 SDATA I/O Serial Data (pin 40)

How I think I understand it is....

I must enter program mode, then send a series of 20 bit messages to the PIC's SDATA line to access the EEPROM (20 bit to access the EEPROM, 20 bit message to set the address, third 20 bit message to initiate a memory read, and finally to read it.

How exactly do I connect the arduino in all of this?

The PIC Serial line (pin 40) is I/O while the arduino Serial is one for TX and one for RX (pin 0,1)..

oops

You can connect an Arduino to a Pic and read out the Pics eeprom content, but not without the Pic having a suitable program to allow it to communicate with the Arduino, so you have to use a Pic programmer to make that happen.

If you have a Pic programmer , then there is no need to use the Arduino as Pic programmers have the ability to read out and display EErpom - see picture.

You can buy a ready made Pickit programmer quiet cheaply or build a very basic diy one for about £12 / $16

You need two lines for the data. It uses synchronous serial communication (by the looks of it) where the SCLK is used to clock data into the PIC or out of the PIC. You nerd to consult the datasheet of the micro on the Arduino (Atmel 328 for an Uno) to see if it supports it; I'm not sure.

You probably have to get the PIC in programming mode by applying a higher than usual voltage to the Vpp pin; my knowledge however is a very rusty in this area.

Can you provide a link to the programming manual so I can have a look.

Georgeduino:
The PIC (44pin TQFP) had some data stored on EEPROM and I am trying to get it out. Therefore I am not trying to program, just access the EEPROM function.

What has this got to do with CAN - which was in the first line of your Original Post?

What does the PIC datasheet say about accessing the PIC EEPROM?

...R