Alan B. Pearce wrote: > Has anyone done any code to make an 18F CAN chip or MCP2515 CANbus chip > search for the baudrate? > > The Microchip documentation seems to say one could search for the baudrate > in listen only mode, but it seems to suggest that the way to do it is set a > baud rate, and listen for a message, if there is an error adjust the > baudrate, but no pointers on how to short circuit the process beyond > stepping the baudrate generator by one and try again. It seems to me that > there should be a more direct method once one has a message or two to > analyse, to sort out they likely baudrate, but I don't really know enough > about CAN to spot it. At the extreme I can get at the bus with a scope as a > starter, but it would be nice to just "plug in and find" as it seems > potentially easier. > > Have an application coming up where I would like to reverse engineer the > data protocol, but don't know the baudrate, but want to have a chip listen > in and report the messages to somewhere I can get at them. > > TIA > > I haven;'t done any Can bus work, but there is a generic method of doing this: The way I've done this is to temporarily take the monitoring PIC out of serial mode and measure the width of the start bit by simply looping. Then you consult a lookup table that can tell you what you need to be using as the baudrate divisor. Of course, there needs to be about an hour of testing to determine the baudrate values, by sending something out of Hyperterminal at the various baud rates and doing captures. There are NOT as many possible values as you'd think. --Bob -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist