Because of the Thanksgiving holiday in the U.S., TI E2E™ design support forum responses may be delayed from November 25 through December 2. Thank you for your patience.

This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

write/read ads 8634 register

Part Number: ADS8634
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>;
 };
};

spi0: spi@48030000 {
   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";
  };
circuit diagram is below
 
 

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.

  • Hello,

    Try sending the register address , plus write, and the register content in one single command instead of two separate ones as you described.
    Also, if you could provide a scope shot of the digital communications, CS, SCLK, SDI, SDO, to check timing.
    Looking at your schematic, is HVSS powered? It seems in the image that it is not.

    Regards
    Cynthia
  • Hi Cynthia
    I don't quite follow you.Your mean is I should send write command,including register address and data,then send the read command,
    Please refer to the read/write function in the device driver "spidev.c",

    write(fd,tx,2); --> write the register 06h of ads8634 to the value 04.
    // write(fd,read_cmd,2);
    read(fd,read_cmd,4); --> send total 32 byte to the (DIN & Dout)
    read_cmd include the write address, the fisrt 2 byte is write address for DIN(value: 06h <<1 |1 , 0xff), the following 2 byte is which I want to read from register from Dout.(0xff, 0xff)
    Does this way right ?