Searching \ for '[PIC] PIC24 CAN' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/devices.htm?key=pic
Search entire site for: 'PIC24 CAN'.

Exact match. Not showing close matches.
PICList Thread
'[PIC] PIC24 CAN'
2010\12\14@014153 by Robert Csaba Molnar

picon face
I'm trying to communicate using CAN (PIC24 chip). I have a 2 wire BUS connected to CAN_H and CAN_L, on both end of the BUS I've connected two 120 ohm resistors.
If I set the PIC24 CAN controller in loop-back mode, I get the TX and RX interrupts working.
When configured in normal operation mode it doesn't work.

2010\12\14@075253 by Olin Lathrop

face picon face
Robert Csaba Molnar wrote:
> I have a 2 wire BUS connected to CAN_H and CAN_L, on both end of the
> BUS I've connected two 120 ohm resistors.

Then your impedence is too low.  Each end needs to be terminated by a
*single* 120 Ohm resistor, making the total bus impedence 60 Ohms.  In your
case it's 30 Ohms, which is lower than the drivers are intended to drive.

> If I set the PIC24 CAN
> controller in loop-back mode, I get the TX and RX interrupts working.
> When configured in normal operation mode it doesn't work.

You really think "doesn't work" describes the problem well enough for anyone
to help!?  Duh!  Obviously more information is needed for anyone to help or
for you to diagnose it.

Do you see the message on the CANH and CANL lines?  Are both floating about
2.5V with about 900mV excursions but in opposite directions for each bit?
Is there another node on the bus so that a ACK is generated?  Does the
sending PIC give any error indication?  Does it keep resending the message?
What does the receiving node see?  Have you put a CAN sniffer on the bus to
see what frames are going by?


********************************************************************
Embed Inc, Littleton Massachusetts, http://www.embedinc.com/products
(978) 742-9014.  Gold level PIC consultants since 2000

2010\12\14@083639 by Robert Csaba Molnar

picon face
Sorry for the ambiguous message.

Each end is in fact terminated by a single 120 Ohm and the impedence (measured) is 60 Ohm.

There are 2 nodes on the BUS, I didn't get any errors on the sending PIC and it does try to resend the message (there is an infinite loop on the sending PIC sending the messages).

I do not have any means to see if there is anything on the CAN lines, nor a sniffer.
What's odd is that I'm using DMA and the TX buffer interrupt flag is never set.

--- On Tue, 12/14/10, Olin Lathrop <spam_OUTolin_piclistTakeThisOuTspamembedinc.com> wrote:

From: Olin Lathrop <.....olin_piclistKILLspamspam@spam@embedinc.com>
Subject: Re: [PIC] PIC24 CAN
To: "Microcontroller discussion list - Public." <piclistspamKILLspammit.edu>
Date: Tuesday, December 14, 2010, 2:53 PM

Robert Csaba Molnar wrote:
> I have a 2 wire BUS connected to CAN_H and CAN_L, on both end of the
> BUS I've connected two 120 ohm resistors.

Then your impedence is too low.  Each end needs to be terminated by a
*single* 120 Ohm resistor, making the total bus impedence 60 Ohms.  In your
case it's 30 Ohms, which is lower than the drivers are intended to drive.

> If I set the PIC24 CAN
> controller in loop-back mode, I get the TX and RX interrupts working.
> When configured in normal operation mode it doesn't work.

You really think "doesn't work" describes the problem well enough for anyone
to help!?  Duh!  Obviously more information is needed for anyone to help or
for you to diagnose it.

Do you see the message on the CANH and CANL lines?  Are both floating about
2.5V with about 900mV excursions but in opposite directions for each bit?
Is there another node on the bus so that a ACK is generated?  Does the
sending PIC give any error indication?  Does it keep resending the message?
What does the receiving node see?  Have you put a CAN sniffer on the bus to
see what frames are going by?


********************************************************************
Embed Inc, Littleton Massachusetts, http://www.embedinc.com/products
(978) 742-9014.  Gold level PIC consultants since 2000

2010\12\14@084309 by Olin Lathrop

face picon face
Robert Csaba Molnar wrote:
> There are 2 nodes on the BUS, I didn't get any errors on the sending
> PIC and it does try to resend the message (there is an infinite loop
> on the sending PIC sending the messages).

So is your firmware doing the resending or is the hardware?  Your firmware
should only send it once.  If the hardware resends it, then that tells you
it didn't get the ACK.  If the firmware keeps resending it, then you don't
know what's going on.

> I do not have any means to see if there is anything on the CAN lines,

Not even a oscilloscope?  A oscilloscope is a very useful tool for debugging
things like this, to the point where trying to do it without one is mostly a
waste of time.


********************************************************************
Embed Inc, Littleton Massachusetts, http://www.embedinc.com/products
(978) 742-9014.  Gold level PIC consultants since 2000

2010\12\14@090504 by Kerry Wentworth

flavicon
face
A digital volt meter can at least tell you if something is being sent, although it can't tell you WHAT is being sent.

Kerry


Olin Lathrop wrote:
{Quote hidden}

-- Internal Virus Database is out-of-date.
Checked by AVG Anti-Virus.
Version: 7.0.289 / Virus Database: 267.11.13 - Release Date: 10/6/05

2010\12\14@090753 by alan.b.pearce

face picon face
> What's odd is that I'm using DMA and the TX buffer interrupt flag is
never set.

On the Transmit end? I haven't played with CAN, so assume this interrupt
should be set when the buffer has been transmitted - presumably with an
appropriate acknowledgement. If this is the case then not getting an
acknowledgement is a likely cause. If there is no acknowledgement, are
both nodes working at the same baud rate ??

But as Olin says, some basic test equipment to see what happens on the
data lines is required.
-- Scanned by iCritical.

2010\12\14@091406 by Olin Lathrop

face picon face
Kerry Wentworth wrote:
> A digital volt meter can at least tell you if something is being sent,

Not neccessarily.  The bits go by so fast that the average voltage may not
change enough so show up on a voltmeter.

If you just want to know something was sent, connect a CAN line to a audio
preamp input.  Each message should sound something like a click.  If you get
nothing, then you know the bus lines aren't wiggling at all.  Do this test
on both of the CAN lines independently to make sure they are both wiggling.

Again however, without a 'scope, this is going to be quite a time sink.


********************************************************************
Embed Inc, Littleton Massachusetts, http://www.embedinc.com/products
(978) 742-9014.  Gold level PIC consultants since 2000

2010\12\14@092012 by Robert Csaba Molnar

picon face
I don't have an oscilloscope, all I have is a digital volt meter.
Using the volt meter all I see is 2.5 Volts. I will try to get an oscilloscope and see if there is something sent on the wire.
Both nodes run at same baud, same PIC24 and almost the same software (a min or change in one of the nodes to keep sending the messages).



--- On Tue, 12/14/10, .....alan.b.pearceKILLspamspam.....stfc.ac.uk <EraseMEalan.b.pearcespam_OUTspamTakeThisOuTstfc.ac.uk> wrote:

From: alan.b.pearcespamspam_OUTstfc.ac.uk <@spam@alan.b.pearceKILLspamspamstfc.ac.uk>
Subject: RE: [PIC] PIC24 CAN
To: KILLspampiclistKILLspamspamMIT.EDU
Date: Tuesday, December 14, 2010, 4:07 PM

> What's odd is that I'm using DMA and the TX buffer interrupt flag is
never set.

On the Transmit end? I haven't played with CAN, so assume this interrupt
should be set when the buffer has been transmitted - presumably with an
appropriate acknowledgement. If this is the case then not getting an
acknowledgement is a likely cause. If there is no acknowledgement, are
both nodes working at the same baud rate ??

But as Olin says, some basic test equipment to see what happens on the
data lines is required.
-- Scanned by iCritical.

2010\12\14@092153 by RussellMc

face picon face
> Again however, without a 'scope, this is going to be quite a time sink.

An old and horrible and good enough to make a vast difference scpope
can often be had a near throwaway prices. Better is better, but almost
any scope is vastly superior to none at all.


 Russel

2010\12\14@092826 by Kerry Wentworth

flavicon
face
It's certainly possible that a single byte might go by too fast for the voltmeter to respond, but the OP indicated that the bytes are being resent continuously, and if they are not, he could modify the software so that they are.

Obviously, a scope is the tool of choice, but if the only tool available is a volt meter, then it is what will have to do.

Kerry


Olin Lathrop wrote:
{Quote hidden}

-- Internal Virus Database is out-of-date.
Checked by AVG Anti-Virus.
Version: 7.0.289 / Virus Database: 267.11.13 - Release Date: 10/6/05

2010\12\14@093514 by PETER ONION

flavicon
face


--- On Tue, 14/12/10, Olin Lathrop <RemoveMEolin_piclistTakeThisOuTspamembedinc.com> wrote:

> Again however, without a 'scope, this is going to be quite
> a time sink.

Having gone through this process myself a few years ago I can only agree with what Olin has said.

I don't know if the Newer CAN modules are easier to use, but the one in the 18F4585 is quite complex to set up and debug.

I would suggest that to start with you set up the Rx side to accept ALL messages it see on the wire.  Don't try to set up any masks or filters until you can get it working like that.

Who's code are you using to setup the CAN module ?

PeterO

2010\12\14@094159 by Kerry Wentworth

flavicon
face
Did you try the meter on AC volts?

Can you slow down the baud rate?

Can you start/stop transmissions?

Kerry


Robert Csaba Molnar wrote:
{Quote hidden}

-- Internal Virus Database is out-of-date.
Checked by AVG Anti-Virus.
Version: 7.0.289 / Virus Database: 267.11.13 - Release Date: 10/6/05

2010\12\14@095739 by Robert Csaba Molnar

picon face
I've tried to slow down the baud rate an mostly everything that can be done via software. I will get an oscilloscope and see if anything goes out on the wire.

--- On Tue, 12/14/10, Kerry Wentworth <RemoveMEkwentworthEraseMEspamEraseMEskunkworksnh.com> wrote:

From: Kerry Wentworth <RemoveMEkwentworthspam_OUTspamKILLspamskunkworksnh.com>
Subject: Re: [PIC] PIC24 CAN
To: "Microcontroller discussion list - Public." <RemoveMEpiclistTakeThisOuTspamspammit.edu>
Date: Tuesday, December 14, 2010, 4:42 PM

Did you try the meter on AC volts?

Can you slow down the baud rate?

Can you start/stop transmissions?

Kerry


Robert Csaba Molnar wrote:
{Quote hidden}

-- Internal Virus Database is out-of-date.
Checked by AVG Anti-Virus.
Version: 7.0.289 / Virus Database: 267.11.13 - Release Date: 10/6/05

2010\12\14@134100 by Oli Glaser

flavicon
face
On 14/12/2010 14:57, Robert Csaba Molnar wrote:
> I've tried to slow down the baud rate an mostly everything that can be done via software. I will get an oscilloscope and see if anything goes out on the wire.

An oscilloscope is essential for anything more than basic electronics, so that is definitely a good idea.
In the meantime though a couple of ideas:
The audio input Olin mentioned is a good idea, nice and simple. Or if you have a PicKit2 it has a logic analyser you could use (just in case you do and you didn't know..)
Or a PC sound card with a freeware scope program (only something like max 128Ksps depending on hardware, but suitable for low baud rates - make sure voltages are within card input range, divide down/buffer if necessary)
Or use a free input on the PIC (or a separate PIC) to sense basic activity.
If you want to do something a little more involved, someone posted a PIC based logic analyser project a few days ago which might be useful for you to check out. Quite a few PIC based scopes out there too.

2010\12\14@135003 by Vitaliy

face
flavicon
face
Robert,

Out of curiosity, what is the application?

Vitali

2010\12\14@140747 by Josh Koffman

face picon face
On Tue, Dec 14, 2010 at 1:40 PM, Oli Glaser <EraseMEoli.glaserspamEraseMEtalktalk.net> wrote:
> An oscilloscope is essential for anything more than basic electronics,
> so that is definitely a good idea.
<snip>
> If you want to do something a little more involved, someone posted a PIC
> based logic analyser project a few days ago which might be useful for
> you to check out. Quite a few PIC based scopes out there too.

I second the idea of a logic analyzer. I haven't really checked out
the one that was just posted (though I did bookmark the link for
future review) as I have a working computer based analyzer for now.
They really help out when debugging communications, especially if they
have a protocol interpreter for the protocol you're working on. I just
wish the manufacturer of my unit (Intronix) would either add a few new
interpreters or add a method of allowing the user to define them. I'd
love a few more than what comes standard with the software. Their
current answer is to export the data and do the analysis in a separate
program.

Josh
-- A common mistake that people make when trying to design something
completely foolproof is to underestimate the ingenuity of complete
fools.
        -Douglas Adams

2010\12\14@153231 by Robert Csaba Molnar

picon face
Thanks for the replies.
I have PickKit2, I'll look into the logic analyzer. I use MPLAB and the C30 compiler from Microchip.

The application is a simple. Controls access to doors. There will be up 20-30 devices connected, each controlling 1 or more doors.

I managed to get everything working except the ECAN controller.

In the meantime I'll try to get my hands on an oscilloscope, the audio trick is a nice idea.



I took out the transceiver and set up the pins connected to it as IO, but i always get 0 on those pins.
Thanks again, I'll keep you posted with my results.

Robert

--- On Tue, 12/14/10, Josh Koffman <@spam@joshybear@spam@spamspam_OUTgmail.com> wrote:

From: Josh Koffman <spamBeGonejoshybearspamKILLspamgmail.com>
Subject: Re: [PIC] PIC24 CAN
To: "Microcontroller discussion list - Public." <.....piclistspam_OUTspammit.edu>
Date: Tuesday, December 14, 2010, 9:07 PM

On Tue, Dec 14, 2010 at 1:40 PM, Oli Glaser <TakeThisOuToli.glaser.....spamTakeThisOuTtalktalk.net> wrote:
> An oscilloscope is essential for anything more than basic electronics,
> so that is definitely a good idea.
<snip>
> If you want to do something a little more involved, someone posted a PIC
> based logic analyser project a few days ago which might be useful for
> you to check out. Quite a few PIC based scopes out there too.

I second the idea of a logic analyzer. I haven't really checked out
the one that was just posted (though I did bookmark the link for
future review) as I have a working computer based analyzer for now.
They really help out when debugging communications, especially if they
have a protocol interpreter for the protocol you're working on. I just
wish the manufacturer of my unit (Intronix) would either add a few new
interpreters or add a method of allowing the user to define them. I'd
love a few more than what comes standard with the software. Their
current answer is to export the data and do the analysis in a separate
program.

Josh
-- A common mistake that people make when trying to design something
completely foolproof is to underestimate the ingenuity of complete
fools.
        -Douglas Adams

2010\12\14@154948 by Jan-Erik Soderholm

face picon face
On 2010-12-14 21:32, Robert Csaba Molnar wrote:

> I took out the transceiver and set up the pins connected to it as IO,
> but i always get 0 on those pins.
>

Either the pins are non-functional or mis-configured.
As long as you can't get the pins to work as normal
I/O pins, there is no reason to try them as CAN pins.

2010\12\15@152539 by Robert Csaba Molnar

picon face
As promised here is the result: the transceivers on both devices I used (2 out of total 3) were bricked... just my luck. Replaced them and everything works fine. Probably someone connected them on a bus without the 120 Ohm resistors.
Thank you all for your suggestions :)

Robert
--- On Tue, 12/14/10, Jan-Erik Soderholm <TakeThisOuTjan-erik.soderholmKILLspamspamspamtelia.com> wrote:

From: Jan-Erik Soderholm <.....jan-erik.soderholmspamRemoveMEtelia.com>
Subject: Re: [PIC] PIC24 CAN
To: "Microcontroller discussion list - Public." <RemoveMEpiclistspamspamBeGonemit.edu>
Date: Tuesday, December 14, 2010, 10:48 PM

On 2010-12-14 21:32, Robert Csaba Molnar wrote:

> I took out the transceiver and set up the pins connected to it as IO,
> but i always get 0 on those pins.
>

Either the pins are non-functional or mis-configured.
As long as you can't get the pins to work as normal
I/O pins, there is no reason to try them as CAN pins.

More... (looser matching)
- Last day of these posts
- In 2010 , 2011 only
- Today
- New search...