View previous topic :: View next topic |
Author |
Message |
Martinez_pt
Joined: 26 Sep 2008 Posts: 11
|
|
Posted: Mon Sep 29, 2008 11:06 am |
|
|
Hi ambrojohn, thank you for your quick response.
My PCWDH version is the following:
I'll try your suggestion.
Thank you again.
Martinez_pt |
|
|
Martinez_pt
Joined: 26 Sep 2008 Posts: 11
|
|
Posted: Mon Sep 29, 2008 11:18 am |
|
|
ambrojohn wrote: |
Here is the output I get on the PC via rs232:
Code: | ===========================================
Comunication Test with a CAN message
from NODE_1 to NODE_2 and back to NODE_1
===========================================
Operating Mode.........0 (0 normal, 1 disable, 2 loopback, 3 listen, 4 config)
Messages Received......3 (0 valid, 1 standard, 2 extended, 3 all)
Bit rate...............125.00 kb/s
Specify ID and data of the message
ID: 0xaa
data: hello
PUT 1: ID=AA LEN=5 PRI=3 EXT=1 RTR=0
DATA = 68 65 6C 6C 6F
PUT 1: ID=AA LEN=5 PRI=3 EXT=1 RTR=0
DATA = 68 65 6C 6C 6F
PUT 1: ID=AA LEN=5 PRI=3 EXT=1 RTR=0
DATA = 68 65 6C 6C 6F |
Now, you have all the elements to evaluate where I'm wrong.
Hoping in some help. Thank you.
Ambrogio |
You dont have any problem with your system, since you send data to node 1 from PC the data is coded in ASCII, so you recive the ASCII code for h, e , l, l, o.
As you can see if you visit this link:
http://www.asciitable.com/
char ASCII code (in hex)
h----------------------68
e----------------------65
l----------------------6C
l--------------------- 6C
o--------------------- 6F
hope this help.
Martinez_PT |
|
|
Martinez_pt
Joined: 26 Sep 2008 Posts: 11
|
|
Posted: Mon Sep 29, 2008 5:33 pm |
|
|
Thank you ambrojohn!!
Now I can compile the examples.
I'll try the example on loopback mode, then I'll try something like you, connect two boards with PIC 18F4580 + MCP2551.
Two more days and I should be trying those.
Thank you again
Martinez_pt |
|
|
ambrojohn
Joined: 27 Apr 2008 Posts: 18
|
|
Posted: Wed Oct 01, 2008 2:07 am |
|
|
Hi Martinez_pt
Yes, I know about the correspondence about the chars of the word "hello" and their corresponding ASCI codes in hexadecimal value ;-)
My problem is that, although the software seems to have sent the message, when I connect an oscilloscope to the MCP2551 CANH and CANL I cannot see any signs of the message!!!!
And that should be the reason I cannot receive anything with a connected receiving node.
Hope we can help each other and work it out. |
|
|
Martinez_pt
Joined: 26 Sep 2008 Posts: 11
|
|
Posted: Wed Oct 01, 2008 2:11 pm |
|
|
Hi ambrojohn.
Do you have a bootloader for your PIC?
I tried the microchip AP the bootloader they provide it's for older models.
Thank you. |
|
|
ambrojohn
Joined: 27 Apr 2008 Posts: 18
|
|
Posted: Thu Oct 02, 2008 1:27 am |
|
|
Are you talking about AN247?
They have disabled the link....
What the bootloader was used for? Can you explain it to me? |
|
|
Martinez_pt
Joined: 26 Sep 2008 Posts: 11
|
|
Posted: Thu Oct 02, 2008 9:31 pm |
|
|
The bootloader was to program the PIC over the board, so I don't have to take it off and use a PIC flash.
Anyway I already got it to work with Tiny PIC Bootloader.
Make some changes on *asm file and it works fine.
Thank you anyway.
I'm waiting for the transceiver's from Microchip to test the bus.
Then I'll say anything about it.
regards
Martinez_pt |
|
|
ambrojohn
Joined: 27 Apr 2008 Posts: 18
|
|
Posted: Fri Oct 03, 2008 1:55 am |
|
|
Martinez_pt wrote: |
I'm waiting for the transceiver's from Microchip to test the bus.
|
Ok, I'm waiting for your results.
Bye |
|
|
Martinez_pt
Joined: 26 Sep 2008 Posts: 11
|
|
Posted: Sun Oct 26, 2008 11:46 pm |
|
|
Ok, I got it work.
I used the CCS EX_CAN.C example and it works fine for me.
I can communicate between two boards (18F4580 or 18F4480 + MCP 2551) over the CAN Bus.
I think your problem is on Bit rate, but I can not say any thing for now because I just start with this.
But anyway try something like LOOPBACK.
On this mode the CAN controller do not send anything to the bus, but you can test if you received any thing on the rx_buffer.
If you look on MCP 2551 datasheet you'll see that the value for Rs resistor is 0 ohm for max speed and have a range from 10Kohm to 100Kohm to select slope-control, I'm my case I used a 10k resistor.
If you want I can send you my HW schema and the modifications on the EX_CAN.C.
For me the rate of 125 Kbps is enough, so I don't think I will change any thing that way, I'll have to configure some filters and masks so I'll keep in touch.
Regards
Martinez_pt |
|
|
ambrojohn
Joined: 27 Apr 2008 Posts: 18
|
|
Posted: Mon Oct 27, 2008 2:43 am |
|
|
Hello Martinez_pt. I'm happy to listen to you again.
Martinez_pt wrote: | Ok, I got it work.
I used the CCS EX_CAN.C example.
|
Me too.
Quote: |
I think your problem is on Bit rate, but I can not say any thing for now because I just start with this.
|
I tried many different bit rate setting (the same on both board), but it never works, till now.
Quote: |
But anyway try something like LOOPBACK.
|
I tried with it, long time ago. And it worked fine.
Quote: |
If you look on MCP 2551 datasheet you'll see that the value for Rs resistor is 0 ohm for max speed and have a range from 10Kohm to 100Kohm to select slope-control, I'm my case I used a 10k resistor.
|
Yes I had used 4700 ohm resistor.
Quote: |
If you want I can send you my HW schema and the modifications on the EX_CAN.C.
|
Yes. I'm very curious to see it. Just to compare it with mine.
http://ambrojohn.altervista.org/CAN_nodes.PNG
Thank you martinez_pt. And I hope to make my circuit work thanks to your results.
Regards
Ambrogio |
|
|
Martinez_pt
Joined: 26 Sep 2008 Posts: 11
|
|
|
ambrojohn
Joined: 27 Apr 2008 Posts: 18
|
|
Posted: Mon Oct 27, 2008 5:56 pm |
|
|
Many thanks for those informations!
I will try them during next weekend (unfortunately, I have not the board with me).
Now you can transmit via CAN. You could try to send a message from node A to node B and then resend the same message back to node A and see it via RS232. In this way you can see, and let me know, if you can also receive correctly messages.
I hope to return with good news.
Ambrogio |
|
|
ambrojohn
Joined: 27 Apr 2008 Posts: 18
|
|
Posted: Mon Oct 27, 2008 6:04 pm |
|
|
Have you tried to make it work with the PICs internal oscillator? |
|
|
Martinez_pt
Joined: 26 Sep 2008 Posts: 11
|
|
Posted: Mon Oct 27, 2008 8:30 pm |
|
|
Hi, Ambrogio.
ambrojohn wrote: | Have you tried to make it work with the PICs internal oscillator? |
No, I didn't. I have used an external oscillator 20 MHz.
I'll try to make your SW objective work.
If I was able to do it I let you know.
Best regards
Martinez_pt |
|
|
ambrojohn
Joined: 27 Apr 2008 Posts: 18
|
|
Posted: Tue Oct 28, 2008 7:33 am |
|
|
Do you think I could use the same 20 MHz oscillator for both PICs?
A |
|
|
|