Hello
I have problems to get the GPIO Port Expander MCP23S17 to run and to use the Driver gpio-mcp23s08.c on a i.MX6
I have add the following Kernel configs
CONFIG_GPIO_MCP23S08=y
CONFIG_SPI_IMX=y
I have change my Devicetree like following:
&ecspi1 {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_ecspi1>;
fsl,spi-num-chipselects = <2>;
cs-gpios = <
&gpio2 30 GPIO_ACTIVE_HIGH
&gpio3 19 GPIO_ACTIVE_HIGH
>;
status = "okay";
gpiom0: gpio8@0 {
compatible = "microchip,mcp23s17";
gpio-controller;
#gpio-cells = <2>;
microchip,spi-present-mask = <0x01>;
reg = <0>;
spi-max-frequency = <1000000>;
};
spidev1: spi@1 {
compatible = "spidev";
reg = <1>;
spi-max-frequency = <54000000>;
};
};
With
dmesg | grep spi
I get
[ 3.751757] spi_imx 2008000.ecspi: registered master spi0
[ 3.756600] spi spi0.0: spi_imx_setup: mode 0, 8 bpw, 1000000 hz
[ 3.761616] spi spi0.0: setup mode 0, 8 bits/w, 1000000 Hz max --> 0
[ 3.770168] spi_imx 2008000.ecspi: registered child spi0.0
[ 3.780987] spi spi0.1: spi_imx_setup: mode 0, 8 bpw, 54000000 hz
[ 3.785848] spi spi0.1: setup mode 0, 8 bits/w, 54000000 Hz max --> 0
How do I load, test and use the gpio-mcp23s08 Driver?
regards
Tobias
Solved! Go to Solution.
Hi Tobias
control registers of MCP23S17 should be programmed appropriately, please
check examples on
https://www.raspberrypi.org/forums/viewtopic.php?t=5987
http://www.retrosemi.co.uk/mcp23s17/Getting_started_with_the_mcp23s17.pdf
Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hello
thanks for the examples.
I have now finished the experiment with the Decivetree, I don't get it run.
I have now implement my own control for the mcp23s17 like the example.
But now I get on every transfer on the spi bus the following message:
mx51_ecspi_clkdiv: fin: 60000000, fspi: 50000000, post: 0, pre: 1
Whats wrong now?
regards
Tobias
seems ratio between fin, fspi should be integer, please look at
Figure 18-1 i.MX6DQ Reference Manual
http://cache.freescale.com/files/32bit/doc/ref_manual/IMX6DQRM.pdf
Best regards
igor
Hello
thanks for the answer
the Problem was that I have enabled the DEBUG messages from the kernel and the the driver spi-imx.c allays displays its frequency.
function: mx51_ecspi_clkdiv:
pr_debug("%s: fin: %u, fspi: %u, post: %u, pre: %u\n", __func__, fin, fspi, post, pre);
Best regards
Tobias
Hi Tobias
control registers of MCP23S17 should be programmed appropriately, please
check examples on
https://www.raspberrypi.org/forums/viewtopic.php?t=5987
http://www.retrosemi.co.uk/mcp23s17/Getting_started_with_the_mcp23s17.pdf
Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------