Hi,

On Mon, Nov 16, 2009 at 9:58 PM, Paul Thomas <[email protected]> wrote:

> 3. Now I can read/write registers. I don't even need to use my hacked
> /proc/file to test this. This is the only time "ip link set can0 type
> can bitrate 50000" shows a actual numbers on the CNF debug line
> "mcp251x spi1.3: CNF: 0x09 0xbf 0x02".
>

if I remember well you told me that the oscillator frequency is 20 Mhz
( = Fosc). So from the CNFs:

SJW = 1 x Tq
BRP = 9 => Tq = 2 * (9 + 1) / Fosc = .000001 s
PHSEG1 = 8 x Tq
PRSEG = 8 x Tq
PHSEG2 = 3 x Tq

so the baud rate is = 1 / tbit = 1 / ( (1 + 8 + 8 + 3) * Tq) = 50000 bit/s

I think this is all right. I don't see any big problems as far as your
other devices have similar parameters. Just to double check what we've
seen privately:

1) does loopback mode work okay?

2) when you connect the bus you see that the mcp2515 goes in TX passive mode?

3) can you try another, higher, baud rate?


> The only way I've found to get back to this state is to unload &
> reload the driver. I understand that you can only mess with some of
> the mcp251x registers when CANCTRL is in configuration mode, but at
> the very least on startup you shouldn't need the failed link up
> command for it to work. And probably whenever the link is down in
> should be configurable.

No, the configuration mode must be explicitly entered:

"The MCP2515 must be initialized before activation.
This is only possible if the device is in the Configuration
mode. Configuration mode is automatically selected
after power-up, a reset or can be entered from any
other mode by setting the CANTRL.REQOP bits to
`100'."

so the driver does a reset before programming the CNF registers.


-- 
Christian Pellegrin, see http://www.evolware.org/chri/
"Real Programmers don't play tennis, or any other sport which requires
you to change clothes. Mountain climbing is OK, and Real Programmers
wear their climbing boots to work in case a mountain should suddenly
spring up in the middle of the computer room."
_______________________________________________
Socketcan-core mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/socketcan-core

Reply via email to