View previous topic :: View next topic |
Author |
Message |
georpo
Joined: 18 Nov 2008 Posts: 281 Location: Athens, Greece.
|
DSPIC33EP128GP506 CAN BAUD RATE |
Posted: Thu Jan 25, 2024 3:29 am |
|
|
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: 19539
|
|
Posted: Thu Jan 25, 2024 3:43 am |
|
|
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: 281 Location: Athens, Greece.
|
|
Posted: Thu Jan 25, 2024 3:55 am |
|
|
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: 9243 Location: Greensville,Ontario
|
|
|
georpo
Joined: 18 Nov 2008 Posts: 281 Location: Athens, Greece.
|
|
Posted: Thu Jan 25, 2024 6:21 am |
|
|
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: 19539
|
|
Posted: Thu Jan 25, 2024 7:33 am |
|
|
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: 281 Location: Athens, Greece.
|
|
Posted: Thu Jan 25, 2024 7:38 am |
|
|
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: 19539
|
|
|
georpo
Joined: 18 Nov 2008 Posts: 281 Location: Athens, Greece.
|
|
Posted: Thu Jan 25, 2024 7:50 am |
|
|
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: 303
|
|
Posted: Thu Jan 25, 2024 7:54 am |
|
|
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: 19539
|
|
Posted: Thu Jan 25, 2024 7:54 am |
|
|
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: 303
|
|
Posted: Thu Jan 25, 2024 7:57 am |
|
|
For 3.3V processors I have personally used both the TJA1042T/3 and SN65HVD230D |
|
|
georpo
Joined: 18 Nov 2008 Posts: 281 Location: Athens, Greece.
|
|
Posted: Thu Jan 25, 2024 8:00 am |
|
|
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. |
|
|
|