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

DSPIC33EP128GP506 CAN BAUD RATE

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
georpo



Joined: 18 Nov 2008
Posts: 278
Location: Athens, Greece.

View user's profile Send private message

DSPIC33EP128GP506 CAN BAUD RATE
PostPosted: Thu Jan 25, 2024 3:29 am     Reply with quote

Hello,

I am using a DSPIC33EP128GP506 with MCP2551.

Code:

#use delay(clock=120MHz, crystal=8MHz)



How can I set the baud rate to 500K?
What are the proper values for C1CFG1 and C1CFG2?
it is a complete mess for me.

Thanks for any tips.
_________________
George.
Ttelmah



Joined: 11 Mar 2010
Posts: 19231

View user's profile Send private message

PostPosted: Thu Jan 25, 2024 3:43 am     Reply with quote

Do what everyone else does. Use one of the online calculators.
Standard way is to use one, then sit down and do one set of calculations
yourself to be 'happy' with the values you are being given.
So (for example):
[url]
http://www.bittiming.can-wiki.info/
[/url]
Select the PIC33 as the processor type, and go from there.
georpo



Joined: 18 Nov 2008
Posts: 278
Location: Athens, Greece.

View user's profile Send private message

PostPosted: Thu Jan 25, 2024 3:55 am     Reply with quote

Ttelmah thanks for the reply.
No matter what settings, the microchip can bus analyzer tool says "error passive" "TX ERR:128"
_________________
George.
temtronic



Joined: 01 Jul 2010
Posts: 9117
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Thu Jan 25, 2024 6:05 am     Reply with quote

curious was I.
googled this ... microchip can bus analyzer tool says "error passive" "TX ERR:128"

found this

https://e2e.ti.com/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/978244/launchxl-f280049c-can-bus-external-transmit-node-not-recognized

maybe will help ??

I have no idea what ERR:128 is, hopefully there's a 'list of error messages' somewhere....
georpo



Joined: 18 Nov 2008
Posts: 278
Location: Athens, Greece.

View user's profile Send private message

PostPosted: Thu Jan 25, 2024 6:21 am     Reply with quote

it just means that there is no ACK from the other side.
I have the microchip analyzer sending data at 250k verified at the oscilloscope and on the mcp2551 data pin but my dspic never receives. on the other hand I can not set the baud rate values right.

maybe just give up and use mcp2515
_________________
George.
Ttelmah



Joined: 11 Mar 2010
Posts: 19231

View user's profile Send private message

PostPosted: Thu Jan 25, 2024 7:33 am     Reply with quote

The MCP4551 transceiver is a 5v device. Your PIC is a 3.3v device.
Not surprising it doesn't work.
georpo



Joined: 18 Nov 2008
Posts: 278
Location: Athens, Greece.

View user's profile Send private message

PostPosted: Thu Jan 25, 2024 7:38 am     Reply with quote

Ttelmah,
I know that but the mcp2551 data out is connected to a 5v tolerant pin of the dspic.
I have done this before, I do not think this is the problem. Do you? should I add a voltage divider?
_________________
George.
Ttelmah



Joined: 11 Mar 2010
Posts: 19231

View user's profile Send private message

PostPosted: Thu Jan 25, 2024 7:47 am     Reply with quote

Seriously, look at MicroChip's own note on this:

[url]
https://microchip.my.site.com/s/article/CAN-transceiver-for-3-3V-microcontrollers
[/url]
georpo



Joined: 18 Nov 2008
Posts: 278
Location: Athens, Greece.

View user's profile Send private message

PostPosted: Thu Jan 25, 2024 7:50 am     Reply with quote

I have used many many times USB-TTL adapters that are 5V directly to UART '5v tolerant" RX pins with no problem.

OK, I will just add 2 resistors and see how it goes.
_________________
George.
gaugeguy



Joined: 05 Apr 2011
Posts: 289

View user's profile Send private message

PostPosted: Thu Jan 25, 2024 7:54 am     Reply with quote

Are you also planning to resistively divide the PIC output voltage higher?
It is a high speed bus, so should be done correctly.
Ttelmah



Joined: 11 Mar 2010
Posts: 19231

View user's profile Send private message

PostPosted: Thu Jan 25, 2024 7:54 am     Reply with quote

Remember also that Fcan, is not the Fcpu. It is the Fp (peripheral clock), or
this *2. Depends on CANCKS.

I'm more worried about whether the output from the 3.3v device is
reliably seen as Vih on the transceiver. All too common that this is not
the case, and this would give a bus that will not correctly signal the dominant
phase.

I too have used the Texas transceivers mentioned below.

The symptoms you have are of the bus not correctly being driven...


Last edited by Ttelmah on Thu Jan 25, 2024 7:59 am; edited 2 times in total
gaugeguy



Joined: 05 Apr 2011
Posts: 289

View user's profile Send private message

PostPosted: Thu Jan 25, 2024 7:57 am     Reply with quote

For 3.3V processors I have personally used both the TJA1042T/3 and SN65HVD230D
georpo



Joined: 18 Nov 2008
Posts: 278
Location: Athens, Greece.

View user's profile Send private message

PostPosted: Thu Jan 25, 2024 8:00 am     Reply with quote

I just used a completely different example "EX_CAN_CCS_A_PCD.C"
compiled ok, no reception on th pic.

I will try 1k/2k resistors and order some MCP2562
_________________
George.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
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