autowp / arduino-canhacker

CanHacker (lawicel) CAN adapter on Arduino + MCP2515
MIT License
383 stars 114 forks source link

GMLAN 33.3kbps ? #11

Open vkfkbr2 opened 6 years ago

vkfkbr2 commented 6 years ago

I tried to connect to GMLAN (swcan 33.3kbps) but I couldn't. In CANHACKER's settings window there are 10kb 50kb etc but there is no 33.3kbps.

It wants btr0 and btr1 values.

How can I connect to GMLAN with 33.3kbps speed?

autowp commented 6 years ago

You can modify that line https://github.com/autowp/arduino-canhacker/blob/master/CanHacker.cpp#L62 to

MCP2515::ERROR error = mcp2515->setBitrate(CAN_50KBPS, canClock);

to always connect at 50kbps

vkfkbr2 commented 6 years ago

But I need 33.3kbps. if I change that line to "50kbps" will it connect to GMLAN with 33.3kbps?

thanks for quick reply.

autowp commented 6 years ago

Select any of available bitrates from CAN_5KBPS, CAN_10KBPS, CAN_20KBPS, CAN_31K25BPS, CAN_33KBPS, CAN_40KBPS, CAN_50KBPS, CAN_80KBPS, CAN_83K3BPS, CAN_95KBPS, CAN_100KBPS, CAN_125KBPS, CAN_200KBPS, CAN_250KBPS, CAN_500KBPS, CAN_1000KBPS

vkfkbr2 commented 6 years ago

Big thanks for your answers, i need to ask one last thing;

will choosing CAN_33KBPS connect to GMLAN or do i need to replace every 33kbps to 33k3bps ?

kirya-dev commented 3 years ago

will choosing CAN_33KBPS connect to GMLAN or do i need to replace every 33kbps to 33k3bps ?

There naming problem. In real are same.

For working with SWCAN (GMLAN) 33.3kbps modify line 62 as:

MCP2515::ERROR error = mcp2515->setBitrate(CAN_33KBPS, MCP_16MHZ);