7 years, 11 months ago.  This question has been closed. Reason: Spam/Innapropriate

CAN bus frequency LPC1768

I wired up my mbed LPC1768 with a bit of breadboard and couple of CAN drivers, as shown on:

https://developer.mbed.org/handbook/CAN

It worked straight away, surprisingly. The next thing I wanted to do was set the frequency to 500 kHz, since I believe that's what the OBD-II connector on my 2009 BMW uses. So, I modified the program from the page linked above by adding:

if (!can1.frequency(500 * 1000) || !can2.frequency(500 * 1000)) fatal_error("Couldn't set freq\n");

The program still works but I wasn't sure what units or range the frequency function accepts, so I verified the output with my oscilloscope. It seems to me that the frequency selected was actually 250 kHz.

/media/uploads/abainbridge/can_at_250khz.png

Have I misunderstood or done something wrong?

I don't know if this comment is still relevant, but the signal you are showing there has a frequency of 500kHz : You get 2 differents bits (1, then 0) in between your cursors, indicating that it took 4 µs to send 2 bits -> 2 µs to send 1 bit -> 500 kbits/s baudrate The frequency would be 250Khz if you where looking at a square wave, which is obviously not the case. In terms of serial transmission, it's more accurate to use bits/s instead of Hz.

posted by Pierre David 12 Jul 2016

@Pierre. Thanks very much for the response. My question was quite stupid. I figured that out a day or two after I asked it, but I couldn't seem to delete my question because it was still in the review queue. Even now I can only close it based on a choice of 5 reasons, none of which are appropriate. I would like to have erased all trace of my stupidity :-)

posted by Andrew Bainbridge 13 Jul 2016