Hi,
I found a bug (and worked out a way around it; thank you Simon for your post about the mbed registers :-) in the CANbus frequency setting. Basically, using can.frequency() doesn't work for all frequencies (speeds) and since it's a 'void' there is no return value to let you know it hasn't worked.
Would it be possible to make can.frequency() an 'int' so that it returns a pass/fail result. An even bigger modification which might be better is if it was possible to be dual format; use decimal numbers for those speeds that work, but use hex numbers with the 0x prefix to write to the BTR register instead. e.g.
can2.frequency(600000) //sets CAN2 speed to 600kbps
can2.frequency(0x280002) //writes 0x280002 to BTR register for 615kbps
I've posted a topic, CANbus frequency setting, in the other mbed forum with more details and the way I worked around the problem
Thanks in advance.
Sophie x
Hi,
I found a bug (and worked out a way around it; thank you Simon for your post about the mbed registers :-) in the CANbus frequency setting. Basically, using can.frequency() doesn't work for all frequencies (speeds) and since it's a 'void' there is no return value to let you know it hasn't worked.
Would it be possible to make can.frequency() an 'int' so that it returns a pass/fail result. An even bigger modification which might be better is if it was possible to be dual format; use decimal numbers for those speeds that work, but use hex numbers with the 0x prefix to write to the BTR register instead. e.g.
can2.frequency(600000) //sets CAN2 speed to 600kbps
can2.frequency(0x280002) //writes 0x280002 to BTR register for 615kbps
I've posted a topic, CANbus frequency setting, in the other mbed forum with more details and the way I worked around the problem
Thanks in advance.
Sophie x