Quantcast
Channel: Forums - Recent Threads
Viewing all articles
Browse latest Browse all 262198

spi to can driver not working

$
0
0

Hi,

We're developing on the dm8168 platform along with the z3 board.  We are also using the following ezsdk ti-ezsdk_dm816x-evm_5_03_01_15.

The problem we're having is that when the mcp251x module tries to get loaded, it's not successful.  The board file that was put together looks as follows.  Below that will be the output received when loading the module.

static int mcp2515_setup(struct spi_device *sdev)
{
printk(KERN_DEBUG "mcp2515_setup: Entry\n");
// mcp251x_hw_reset(sdev);
int err;

err = gpio_request(21, "CAN shutdown");
if (err)
return err;

err = gpio_direction_output(21, 1);
if (err) {
gpio_free(21);
return err;
}

return 0;
}

static int mcp2515_power_enable(int enable)
{
printk(KERN_DEBUG "mcp2515_power_enable: Entry %d\n", enable);
gpio_set_value(21, !enable);
return 0;
}

static struct mcp251x_platform_data mcp2515_pdata = {
.oscillator_frequency = 32*1000*1000,
.board_specific_setup = &mcp2515_setup,//&mcp251x_setup,
.power_enable = mcp2515_power_enable,
.transceiver_enable= NULL,
};
/*
static void __init overo_mcp251x_init(void)
{
printk(KERN_DEBUG "overo_mcp251x_init: Entry\n");
if ((gpio_request(OVERO_GPIO_CAN_INT, "MCP251x CAN INT") == 0) &&
(gpio_direction_input(OVERO_GPIO_CAN_INT) == 0)) {
gpio_esport(OVERO_FPIO_CAN_INT, 0);
set_irq_type(OMAP_GPIO_IRQ(OVERO_GPIO_CAN_INT), IRQ_TYPE_EDGE_FALLING);
} else {

printk(KERN_ERR "cout not obrain gpio for MCP251x CAN bus interrupt\n");
return;
}
}*/
struct spi_board_info __initdata spidev_board_info[] = {
// First line to add
/*
{
.modalias = "spidev",
.platform_data = 0,
.controller_data = 0,
.irq = -1,
.max_speed_hz = 10000000,//90000,
//.max_speed_hz = 1000000,//75000000,
.bus_num = 1,
.chip_select = 0,
.mode = SPI_MODE_0,
},*/
{
.modalias = "mcp2515",
.platform_data = &mcp2515_pdata,
.controller_data = 0,
.irq = TI81XX_IRQ_GPIO_1B,
.max_speed_hz = 10000000,
.bus_num = 1,
.chip_select = 1,
.mode = SPI_MODE_0,
},

When running 

/ # modprobe can
can: controller area network core (rev 20090105 abi 8)
NET: Registered protocol family 29

/ # modprobe mcp251x
mcp251x spi1.1: Probing the mcp2515 device
mcp251x spi1.1: MCP251x didn't enter in conf mode after reset
mcp251x spi1.1: Probe failed
mcp251x spi1.1: probe failed

I have looked and the mosi, miso, chip select, and reset and they all seem to toggle.  

One thing we did notice is that the mode appears to be 0,1 and not 0,0 for the spi.  The MCP2515 is expecting 0,0 or 1,1.  I'm not sure if that's the issue but it would me nice to know why setting .mode = SPI_MODE_0 doesn't make the wave signals align in that 0,0 mode.

Does anyone know how to solve this issue?

Thanks,

Rodrigo


Viewing all articles
Browse latest Browse all 262198

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>