CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

PIC18F4580 CANBus TX/RX issue - Loopback works...
Goto page Previous  1, 2
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
LMS_EE



Joined: 27 Oct 2010
Posts: 9
Location: Georgia VT

View user's profile Send private message Visit poster's website

PostPosted: Mon Nov 01, 2010 9:27 am     Reply with quote

Hey PCM

Thanks for the step in the right direction. Can you do me a favor when you get a chance and see if you can see canbus output messages on the TX pin of the first MCU when you send it an RS232 command? Can you see the messages when the second MCU is not connected to the first one?

Thanks!
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Nov 01, 2010 1:43 pm     Reply with quote

I used the program that I posted earlier, and compiled it for "Board #1"
and programmed it into the test board. This test is done with Board #1
only. It is not connected to Board #2. It just has the PIC, and MCP2551
and the 120 ohm terminator resistor. It's just one board by itself.

Initially, the TXD pin (pin 1) on the MCP2551 is at a high level (+5v).

I then pressed the Enter key on the PC, while running TeraTerm.
The TXD pin now has constant activity. It has pulses for 2.6ms, then
a high level for 1ms, and then repeats the same pattern constantly.

The RXD pin has the same pattern and levels as the TXD pin.

For the CANH pin, it was sitting at +2.5v initially. When I press the Enter
key once, it puts out constant activity, the same pattern as the above,
but voltage levels are from 2.5v to 3.5v.

For the CANL pin, it was also sitting at +2.5v initially. Whe I pressed Enter
it put out the same constant activity pattern, but with voltage levels from
1.5v to 2.5v.
parchao



Joined: 08 Jan 2011
Posts: 3

View user's profile Send private message

problems board2
PostPosted: Sat Jan 08, 2011 11:32 am     Reply with quote

hi
I am working with an internal oscillator with pic18f4585 8MHz. I like to know how to set the baud rate since the Board2 does not enter the first function

if(can_kbhit()==true)
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sat Jan 08, 2011 2:53 pm     Reply with quote

The CAN bus baud rate is set by the can_set_baud() function, which
is called by can_init().

This thread explains how to use the MBTime program to calculate the
values for can_set_baud():
http://www.ccsinfo.com/forum/viewtopic.php?t=22138
It also has a link to download the MBTime program.
parchao



Joined: 08 Jan 2011
Posts: 3

View user's profile Send private message

problems continued
PostPosted: Thu Jan 13, 2011 4:59 pm     Reply with quote

hi
I set my CAN communication accept any message because it is only way to login to the can_kbhit function () of board2.

Anyone know if you change the mode of reception does not enter the function?
I checked the values are different from those received and sent.
collink



Joined: 08 Jan 2010
Posts: 137
Location: Michigan

View user's profile Send private message Visit poster's website

Re: problems continued
PostPosted: Thu Jan 13, 2011 7:32 pm     Reply with quote

Umm..... HUH?!?! I know a decent amount about CANBus development for PIC chips so I will help you if I can. However, I can't make sense of what you are asking. Can you explain it again?


parchao wrote:
hi
I set my CAN communication accept any message because it is only way to login to the can_kbhit function () of board2.

Anyone know if you change the mode of reception does not enter the function?
I checked the values are different from those received and sent.
parchao



Joined: 08 Jan 2011
Posts: 3

View user's profile Send private message

problems continued
PostPosted: Fri Jan 14, 2011 1:24 pm     Reply with quote

hi

I have configured the reception mode as CAN_RX_ALL and it communicates but the values from the sendings and receptions are different.

This is my problem, can anyone help?

Thanks.
collink



Joined: 08 Jan 2010
Posts: 137
Location: Michigan

View user's profile Send private message Visit poster's website

Re: problems continued
PostPosted: Fri Jan 14, 2011 8:43 pm     Reply with quote

parchao wrote:
hi

I have configured the reception mode as CAN_RX_ALL and it communicates but the values from the sendings and receptions are different.

This is my problem, can anyone help?

Thanks.


You mean that you send certain data and when you receive it it is actually different? Could this be a result of endian issues? (That is, are you expecting least significant byte first on an int16 or int32 but really getting most significant byte first?) Can you post an example (as short as possible) of a program that causes this error? Remember that you don't have to, and in fact should not, post any CCS source code.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group