Other Parts Discussed in Thread: AM4372,
Tool/software: Linux
Hi sir,
I have some question that need your kindness help.
I want to enable internal VREF bit of Aux-Config register (Address = 06h; Page 0).Firstly,I send the data(0x0c),including register address and write/read instruction ,then sent the data(0x04).secondly,I send the read command(0x0D).The question is I can't read the correct date in register(06h).Is there any problem with my understanding?Could you give me some advice?
unsigned int read_ref[2];
unsigned int tx[2];
tx[0]=(0x06<<1);
tx[1]=0x04;
unsigned int read_cmd[2];
read_cmd[0]=((0x06<<1)|0x01);
read_cmd[1]=0xff;
write(fd,tx,2);
write(fd,read_cmd,2);
read(fd,read_ref,2);
printf("read byte is: read_ref[0]=%x read_ref[1]=%x\n",read_ref[0],read_ref[1]);
Here is the result:
root@am437x-evm:/usr/bin# ./spi -D /dev/spidev1.0
[ 273.961755] spidev spi1.0: not using DMA for McSPI (-19)
[ 273.967391] spidev spi1.0: not using DMA for McSPI (-19)
[ 273.977474] spidev spi1.0: not using DMA for McSPI (-19)
spi mode: 0
bits per word: 8
max speed: 1000 Hz (1 KHz)
read byte is: read_ref[0]=10c0d read_ref[1]=b6f06b50
Following is my spi configuration:
spi0_pins_default: spi0_pins_default {
pinctrl-single,pins = <
AM4372_IOPAD(0x950,PIN_INPUT | MUX_MODE0) /* (P23) spi0_sclk.spi0_sclk */
AM4372_IOPAD(0x954,PIN_INPUT | MUX_MODE0) /* (T22) spi0_d0.spi0_d0 */
AM4372_IOPAD(0x958,PIN_OUTPUT | MUX_MODE0) /* (T21) spi0_d1.spi0_d1 */
AM4372_IOPAD(0x95c,PIN_OUTPUT | MUX_MODE0)/* (T20) spi0_cs0.spi0_cs0 */
>;
};
&spi0{
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&spi0_pins_default>;
ti,pindir-d0-in-d1-out = <1>;
spidev@0{
#address-cells = <1>;
#size-cells = <0>;
compatible = "spidev";
reg = <0>;
spi-max-frequency = <1000000>;
};
};
compatible = "ti,am4372-mcspi","ti,omap4-mcspi";
reg = <0x48030000 0x400>;
interrupts = <GIC_SPI 65 IRQ_TYPE_LEVEL_HIGH>;
ti,hwmods = "spi0";
#address-cells = <1>;
#size-cells = <0>;
clocks = <&dpll_per_m2_div4_ck>;
clock-names = "fck";
clock-frequency = <1000000>;
status = "disabled";
};
The SDK is linux-am437x-evm-04.03.00.05.
The kernel is linux-4.9.69.
Look forward to your reply.
Best regards,
lihua.