normaldotcom / canable-fw

Firmware for the CANable USB to CAN adapter
http://canable.io/
Other
184 stars 72 forks source link

Canable issues #6

Closed riodda closed 5 years ago

riodda commented 6 years ago

Hi, i've built a canable clone in minipcie format, the only difference is the transcriver were i opted to a 3.3v Ti Transcriver instead of the MCP 5v. I've tested the cantact firmware and it works (with some issues on the bus loads). I've built this fork but the only thing i have is the blinking green led, i can't bring the can up (no error messages on slcand). I've teste both slcand and slcan_attach ways with no difference. Thanks.

Update1: s0 actually works but at 125kbit.....s8 don't at 1mbit....i'm scratching my head !

Update2: Actually whatever s i give to slcand the bus goes at 125kbit.....

Update3: I've changed the default speed from to 125 to 1Mbit and now i have a 1Mbit working bus, but seems that on operwrt the -s parameter of slcand is ignored, so from -s0 to -s8 the bus is set at the fault speed coded in can.c

What i'm missing ?

Update4: I have the same problems that i have with orignal cantact firmware, depending on bus load the canable stops sending, but keeps receiving. With my script that sends a multiplexd signal every 8 seconds (and the second frame of the multiplex after 200ms) i can send about 140 frames. I tested cangen and with it i can only send 13 frames before the TX side hangs, but still i can RX frames.

jorticus commented 6 years ago

I think I encountered the same problem - the USB adapter would hang or stop transmitting when trying to TX a lot of frames. Solution was to wait for the write to complete before writing another: (example in Qt code)

    mSerialPort->write(slcan_packet);
    mSerialPort->waitForBytesWritten(1000);

I believe this is because the firmware cannot handle too much data in it's own TX buffer. After implementing the above change I can reliably TX a lot of data (though RX is still a little flakey at higher speeds)

jorticus commented 6 years ago

Also when using the Sx command, make sure you close the port first. Firmware ignores that command if it is currently open. Sequence should look like: C\rS4\rO\r.

riodda commented 6 years ago

Then is the slcan driver or the serial driver that has to be modifyed ? Not the cantact firmware ?

normaldotcom commented 5 years ago

Closing this issue; #7 should resolve this issue.