Page 1 of 1

CAN SPI baudrate

Posted: 02 Dec 2015 08:48
by Nikitos
Hello everyone. Last time I found some things which are working on the CANBUS with baudrate 83.3 kBaud. Is it possible to program this baudrate by mikoe CAN SPI or CAN SPI click? I've tried to calculate nessesay quartz, but I did not found the best one. All calculation with possible error (minimal 0.04 %). Or maybe this baudrate needs something special?

Re: CAN SPI baudrate

Posted: 02 Dec 2015 15:36
by Aleksandar.Mitrovic
Hi,

Did you try to use our application for calculation of CAN, CANclulator:
http://www.libstock.com/projects/view/360/canculator

For setting baud rate with CAN SPI I suggest you to take a look at the CANSPI Library Help file.

Best regards,
Aleksandar

Re: CAN SPI baudrate

Posted: 03 Dec 2015 06:37
by Nikitos
Of cource I tried to use calculator. But as you can see on the picture there is no calculated data. It means that this baudrate impossible to CANSPI module? Or what can I do to set this baudrate without errors? I just want to connect CAN SPI to exist CAN BUS with baudrate 83.3 kBaud

Re: CAN SPI baudrate

Posted: 03 Dec 2015 15:41
by Aleksandar.Mitrovic
Hi,

I mange to reproduce the same behavior.
The problem is in CANculator, for some reason he can not calculate correct settings for the PIC MCU.

For AVR, ARM and other is working.

This is forwarded to our developers.

You should set your CAN SPI manually.

Best regards,
Aleksandar

Re: CAN SPI baudrate

Posted: 03 Dec 2015 21:06
by Nikitos
I'm using PIC because as I remember there is a problem with AVR calculation. Can you help me to calculate this manually?

Re: CAN SPI baudrate

Posted: 08 Dec 2015 17:03
by Aleksandar.Mitrovic
Hi,

I suggest you to refer to the manual of the module which you are using.

Which module are you using?

Best regards,
Aleksandar

Re: CAN SPI baudrate

Posted: 09 Dec 2015 05:49
by Nikitos
1) EasyAVR v7 (Atmega32) -> CAN SPI click 5V (nessesary CAN BUS baudrate is 83.333 kBaud)
2) And one more question. How to make chip selection for two CAN SPI click 5v ?
For one module is:

Code: Select all

// CANSPI module connections
sbit CanSpi_CS  at  PORTB0_bit;
sbit CanSpi_CS_Direction  at  DDB0_bit;
How can I do this for two modules?
Is it good frequency of 8 Mhz to read and write both two can spi modules?

Re: CAN SPI baudrate

Posted: 09 Dec 2015 15:35
by Aleksandar.Mitrovic
Dear Nikitos,
Nikitos wrote:I'm using PIC because as I remember there is a problem with AVR calculation.
- To be honest I'm not sure that I understand with which microcontroller are you working now.

I manage to calculate the CAN settings for AVR in CANculator software (please take a look at the picture).

Therefore I suggest you to use that settings for CAN and test your hardware.

Best regards,
Aleksandar

Re: CAN SPI baudrate

Posted: 10 Dec 2015 06:16
by Nikitos
Sorry. I explaned not completly. I used PIC only in calculation software because this post:

http://www.mikroe.com/forum/viewtopic.p ... 15#p217179

and answer to the post
janko.kaljevic wrote:Hello,

Yes this is an error when CANSPI and AVR controllers are selected.
In this case it generates double baud, as you noted.

Thanks for reporting this. It will be fixed for the next version of Canculator.

In meantime you can select other architecture (like PIC) and you will get correct calculation and generated code will compile.

Best regards.
Thanks for help!

Re: CAN SPI baudrate

Posted: 10 Dec 2015 11:13
by Aleksandar.Mitrovic
Hi Nikitos,

This was long time reported and fixed.

Now we have a different problem. :)

I hope that this will work for you.

Regards,
Aleksandar