Wich CAN baudrate is this?

Go To Last Post
16 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hallo, can someone help me and say me, which CAN baudrate i have with these register values

 

ATMega16M1 with 8 MHz extern oszillator

CANBT1 = 0x12 

CANBT2 = 0x0E

CANBT3 = 0x7F

CANBT1 = 0x12 = Div 9 or 10 res BRP5 BRP4 BRP3 BRP2 BRP1 BRP0 res TQ
  0 0 0 1 0 0 1 0  
CANBT2 = 0x0E res SJW1 SJW0 res PRS2 PRS1 PRS0 res  
  0 0 0 0 1 1 1 0 8
CANBT3 = 0x7F res PHS22 PHS21 PHS20 PHS12 PHS11 PHS10SMP    
  0 1 1 1 1 1 1 1 16

 

8.000.000 / 10 / 24TQ = 33,333 kbit/s

8.000.000 / 10 / 25TQ = 32,0 kbit/s

8.000.000 /  9 /  24TQ = 37,037 kbit/s

8.000.000 /  9 /  25TQ = 35,555 kbit/s

or all wrong?

Last Edited: Mon. Sep 16, 2019 - 10:50 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0


 

I would start with using the register setting from the examples in the DS.  Page 240

 

then using a scope or logic analyzer, make your changes as needed to under stand what happens.

Jim

 

 

 

(Possum Lodge oath) Quando omni flunkus, moritati.

"I thought growing old would take longer"

 

Last Edited: Mon. Sep 16, 2019 - 12:46 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Unfortunately, there is no example of my baud rate, so I would like to be able to calculate it myself. I'm already up and down the data sheet, but I'm not behind it

I can watch the data transfer with a DSO a CAN Analyzer from Microchip and a Lawicel Analyzer, but somehow I have an error in it, it will display the ID but no data. That's why I want to start from scratch, not that maybe I have a difference in the data rate.

That's why this cross check would be important for me to what data rate others come.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

kosmos2 wrote:
Unfortunately, there is no example of my baud rate

What baud rate are you wanting?

 

Jim

 

 

(Possum Lodge oath) Quando omni flunkus, moritati.

"I thought growing old would take longer"

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

First of all, I would like to know which baud rate is set at all.

 

I have the problem that my home autmation works reliably, but I would like to access or log on the PC, unfortunately I do not get these loggers set to the same baud rate.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

kosmos2 wrote:
I have the problem that my home autmation works reliably, but I would like to access or log on the PC,

Ok, so your trying to sniff an unknown system.  You will need some basic tools, such as a two channel DSO that you can use to capture the bus states when data is passing.

Another possibility is a logic analyzer.   Do you have either of these available?

Tell us more about your "home automation system", brand, model number, ect.

Are you even sure it is CANbus?

 

 

 

edit: spelling

 

(Possum Lodge oath) Quando omni flunkus, moritati.

"I thought growing old would take longer"

 

Last Edited: Mon. Sep 16, 2019 - 08:48 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It is not an unknown system, because I have developed this myself. Since all my participants work with the same baud rate setting everything works as desired. I only have problems when I hang a foreign participant on the bus.

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 2

kosmos2 wrote:
because I have developed this myself.
If you developed it yourself then surely you know what baud rate you set it to operate at ?? I don't understand.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

You seem to have us all confused, start at the beginning and describe the system your attempting to sniff!

You said something about a home automation system, what brand/model number, or if you designed this your self?

We are trying to help, but so far the info provided is confusing and incomplete.

 

Jim

 

 

(Possum Lodge oath) Quando omni flunkus, moritati.

"I thought growing old would take longer"

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

That's why I wanted to start systematically at the beginning, first determine with which baud rate the system should work due to the above settings.

Maybe I just have a baud rate error.

 

At the moment my system only transmits control faults, for example light 1 in bedroom 1 in upper floor = on.

 

I will post a picture of the oscilloscope tonight.

 

I use only these illustrated boards which either query several buttons and then send the command over the bus. Or they are programmed as receivers and switch the desired lamp via a MOSFET

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

So here's the promised image 200μsek / DIV. I have drawn another division 6 bits / 200 μsec.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Seems like the bit pulses are exactly 200us so it's exactly 5,000 baud

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

the gray graduation corresponds to 200 μsec and the red graduation which I drew over about 33 μsec

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 2

It might be clearer if you just show the scope display and the timebase.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

kosmos2 wrote:
which I drew over about 33 μsec

So that works out to about 30303.03 baud

 

(Possum Lodge oath) Quando omni flunkus, moritati.

"I thought growing old would take longer"

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Which isn't one of the options listed in #1 so I guess it's "all wrong" ;-)