DAC124S085: DAC124S085 : Linux drivers writes command to single channel but output is updated on all channel that too not correct.

Part Number: DAC124S085
Other Parts Discussed in Thread: AM625, TXB0104

Tool/software:

Hi ,

I am using this DAC board DAC124S085EVM Evaluation board | TI.com and linux drivers from kernel.org/doc/Documentation/devicetree/bindings/iio/dac/ti%2Cdac082s085.yaml driver and below is my node , 

&main_spi0 {

ti,spi-num-cs = <2>;
status = "okay";

spidev@0 {
compatible = "rohm,dh2228fv";
reg = <0>;
spi-max-frequency = <23000000>;
};


dac@1 {
compatible = "ti,dac124s085";
reg = <1>;
spi-max-frequency = <30000000>;
spi-cpha;
vref-supply = <&vref_4v095_reg>;
};

};

I have two slaves on my board and only DAC is connected. I am using AM625 SOM  and I can see SPI transections as below over SPI lines using logic anaylser

for 100 counts it sends below on each channel
Channel VOA  when I write 100 using

echo 100 > /sys/bus/spi/devices/spi0.1/leds/dac124s085-0/brightness 

On SPI lines I see signals = 0x64 0x10 = 01100100 00010000

echo 100 > /sys/bus/spi/devices/spi0.1/leds/dac124s085-1/brightness 

On SPI lines I see signals = 0x64 0x50 = 01100100 01010000

echo 100 > /sys/bus/spi/devices/spi0.1/leds/dac124s085-2/brightness 

On SPI lines I see signals = 0x64 0x90 = 01100100 10010000

echo 100 > /sys/bus/spi/devices/spi0.1/leds/dac124s085-0/brightness 

On SPI lines I see signals = 0x64 0xD0 = 01100100 11010000

above signals are as expected.

but on HW this is the behaviour , I dont see any correct relation between my setting and Pin state. Other channels are affected too even when I am not sending command to update all and values are incorrect see below table , I tested one channel at a time and noted the behaviour on other channels.

Channel under test Calculated Values using formula from datahseet Actual Values on IC using multimeter Other Channel voltage when I make a count change on channel under test Comments
Channel A Expected Count Expected Voltage Actual Voltage on pin Actual Count Caculated using formula   B C D  
A 0 0 0.0283 28.3        
A 100 0.1 1.0403 1040.3 1.0403 1.0403 1.04  
A 500 0.5 0.2768 276.8 0.292 0.279 0.41 keep changing
A 1000 1 2.069 2069 2.069 2.065 2.065  
A 1500 1.5 2.2598 2259.8 2.2618 2.2577 3.092  
A 2000 2 2.2598 2259.8 2.2618 2.2577 0.024  
A 3000 3 -0.063 -63 -0.065 -0.068 -0.071 changing gowing more low and again stable
A 4095 4.095 0.5 500 0.498 0.514 0.498 Keep on increaing slowly
Channel B Expected Count Expected Voltage Actual Voltage Actual Count  A C D  
B 0 0 0.0493 49.3        
B 100 0.1 1.1076 1107.6 1.1051 1.1035 1.104  
B 500 0.5 0.334 334 0.289 0.394 0.45 keep changing
B 1000 1 2.1333 2133.3 2.1318 2.1295 2.128  
B 1500 1.5 2.2618 2261.8 2.2599 2.2577 3.155  
B 2000 2 2.2618 2261.8 2.2599 2.2577 0.088  
B 3000 3 -0.063 -63 -0.065 -0.068 -0.071 changing gowing more low and again stable
B 4095 4.095 0.499 499 0.488 0.512 0.498 Keep on increaing slowly
Channel C Expected Count Expected Voltage Actual Voltage Actual Count  A B D  
C 0 0 0.00363 3.63        
C 100 0.1 1.1678 1167.8 1.1694 1.1719 1.168  
C 500 0.5 0.44 440 0.372 0.412 0.477  
C 1000 1 2.1939 2193.9 2.1962 2.1977 2.193  
C 1500 1.5 2.2577 2257.7 2.2599 2.2618 3.21  
C 2000 2 2.2577 2257.7 2.2599 2.2618 0.152  
C 3000 3 -0.073 -73 -0.075 -0.073 -0.075 changing gowing more low and again stable
C 4095 4.095 0.513 513 0.49 0.54 0.498 Keep on increaing slowly
Channel D Expected Count Expected Voltage Actual Voltage Actual Count  A B C  
D 0 0 0.002 2        
D 100 0.1 1.2311 1231.1 1.2333 1.2356 1.231  
D 500 0.5 0.322 322 0.336 0.42 0.32  
D 1000 1 2.2569 2256.9 2.2598 2.2618 2.258  
D 1500 1.5 3.2825 3282.5 2.2599 2.2618 2.258  
D 2000 2 0.215 215 2.2599 2.2618 2.258  
D 3000 3 -0.073 -73 -0.075 -0.073 -0.075  
D 4095 4.095 0.513 513 0.49 0.54 0.498 Keep on increaing slowly

I am not sure why other channels are affected and why voltage on pins are not in map with the counts I write?

when the other channels are affected if I read the value as

cat  sys/bus/spi/devices/spi0.1/leds/dac124s085-1/brightness 

it doesnt change but the output changes when I change channel count.

I VA =5V and ref voltage is 4.095 as.

I connect pins of DAC EVM as below

5V = 5V external power supply with 1A current limit

GND= Common ground

SYNC = CS

CLOCK = CLOCK 

DIN = MOSI

Please help as I do need stable output and single channel control. This is an urgent request please look into this matter. 

Regards,

Varsha 

  • Hi Varsha, 

    Can you confirm CS is connected to JA-2, CLOCK is connected to JA-7, and MOSI is connected to JB-6? 

    They are labeled pretty clearly on the EVM board, but just want to double check:

    Can you measure one of the SPI write frames on the scope and share a screenshot so I can check the SPI format and timings? Share what command you are intending to send for that write so I can double check.

    It's likely that your data is shifted incorrectly and is causing the DAC to interpret the data incorrectly. Can you share the full DAC command you sent for the results in your table? 

    Best,

    Katlynne Jones

  • Hi Katlynne Jones,

    Thanks for your reply. I verified all the pins again and they are correct. See this image for the one write, when I write 450 counts 0xC2 0x11 = 450

  • Hi Varsha, 

    What do you mean by write 450? This command (0xC211) would write data 529 to channel D and not update the output. Is that what you are expecting to happen?

    Best,

    Katlynne Jones

  • Hi, No I expect to update the output on indeividual channel (01 setting for channel 0) I am writing echo 450  > /sys/bus/spi/devices/spi0.1/leds/dac124s085-0/brightness  which means I want the brightness to be 450 counts . Do you mean this is not the correct way?

  • Also I feel, After conversion 
    The lower nibble of 0x11 is data bit so if 0x11 is MSB its 0x1C2 = 450
    0xC211 =1100 0010 0001 0001  The Bold bits are setting 00 means channel number 0 and 01 means write to specific register and update that only. isnt it correct

  • Hi Varsha, 

    This device accepts 16-bit I2C commands. Looking at the I2C waveforms you shared, you are sending the following command: 0xC211 (0b1100 0010 0001 0001) 

    We did not write the drivers you are using, so I'm not exactly sure how they are supposed to work. But the command in the screenshot you shared is writing data 529 to channel D and not update the output. 

    The data is MSB first, so the left side of your scope after the start bit is the first byte of data DB15:0 (0xC2, 0b1100 0010), and the second byte is on the right side of your scope before the stop bit is the second byte of data, DB7:0 (0x11, 0b0001 0001)

    Best,

    Katlynne Jones

  • The anayser is set to show MSB first so 0x11 is MSB?  like when I write 100 counts on each channel this is what I see on analyser , the changing byte is MSB thats what I feel like 0x10, 0x50,0x90 0xD0 in below cases

    -----------------------------------

    Channel DAC A set to 100
    0x64 0x10
    0x64 = 01100100
    0x10 = 00010000

    -----------------------------------

    Channel DAC B set to 100

    0x64 0x50
    0x64 = 01100100
    0x50 = 01010000

    -----------------------------------

    Channel DAC C set to 100

    0x64 0x90
    0x64 = 01100100
    0x90 = 10010000

    -----------------------------------

    Channel DAC D set to 100

    0x64 0xD0
    0x64 = 01100100
    0xD0 = 11010000

    -----------------------------------

    Thanks for supporting,

    Regards,

    Varsha

  • Hi Varsha,

    In your analyzer 0xC2 is being sent as the MSB. If you look at the time scale, time is increasing as you move left to right meaning that the data to the left is the first data being sent out and the data to the right is the last data sent out. 

    0x64 is 100 in decimal, so this should be the LSB like you said, but I don't think your code is actually sending it out like that. Can you send another screenshot of your logic analyzer slightly zoomed out so I can also see the start and stop bit? That should make it clear which byte is the MSB and which is the LSB on the analyzer. Also verify that the code you are using is configured to send out the bytes in the correct order. 

    Best,

    Katlynne Jones

  • Hi Katlynne Jones,

    I have pasted the logic analyser capture for your refernace , below is zoomed image

    Thankyou for your time. I feel I can be online at the time you are available and we can find the solution as ths way it is taking one msg a day :) can you please let me know your timezone so that we can connect?

    Thanks in advance Slight smile

    Regards,

    Varsha

  • Hi Varsha, 

    I misspoke in my last post. This is not I2C so there won't be a start and stop bit. We should be looking at when the enable (SYNC) signal goes low and high. That'll help show which byte of data is being sent first and being sent second.

    Have you looked at your SPI initialization to make sure that the data is configured to be sent in the correct order? Try swapping them from what they are at now. 

    I am in Arizona, USA. 

    Best,

    Katlynne Jones 

  • Hi, Thanks for input. I was on holidays. I cant swap as they are from Linux drivers. Can you please tell me if I have 1.8V SPI signal will that cause issue? if I make this board run on 3V VA and Digital signal is 1.8V. Ref volatge 4.095V. I feell issue with my level converter.

  • Hi Varsha, 

    You cannot edit the drivers? I am pretty confident this is the issue, so we might not make any progress if you are not able to try to swap the order of the data bits. 

    1.8V should work at room temperature, but is not recommended across the full operating temperature:

    Which side of the level shifter are you measuring the data? Make sure you are measuring on the DAC side so we actually see the data that is being received by the DAC. 

    Best,

    Katlynne Jones

  • Hi, I am having 1.8V signal level of SPI , I am using TXB0104 4-Bit Bidirectional Voltage Level Translator and I see the Signal changes on both side of DAC (as expeced signal) but now I do not see any channel changing the output , it has some glitch each time I send the command to IC Over SPI after that it again becomes 0 (Channel A).

    I am level converting from 1.8V to 5V and the freq is 10MHz. can you help ? the DAC VA =5V and Vref is on board 4.096V as, Do we need more current for VREF? whay the output is not changing?  The SPI Clock phase = 1 AND Polarity =0

     

  • Hi Varsha, 

    Can you capture the SPI data on the 5V side of the level translator for the command you are using to update channel A? 

    VREF requires a very small amount of current. The input impedance is 30k, so this would be 0.1mA of current flowing into the pin. 

    Best,

    Katlynne Jones

  • Hi , I will share it tomorrow as I am not at office right now. Can you confirm the previous images I have shared for SPI waveform are correct or not? Like the two bytes are correct or not as per waveform?  Also do you have small code that you are using and already functioning.? Can you share? Also can you share checklist of voltage, or anything that is missing you feel? 

  • Hi Varsha, 

    Are you talking about this image:

    The bytes are not in the correct order.

    I do not have any code for this device. Every microcontroller or SPI controller has different SPI modules, so you need to use what comes with the one you are using and configure it correctly. Typically, SPI mode 1 or 2 works (whatever shifts data on rising edge and captures data on falling edge). DB15 should be sent out first:

    Your timing diagram for data 0x1064 (to update channel A with data 100) should look like the below. With the Enable falling edge where I have marked 0s, and the rising edge where I've marked 2.5us. 

    Best,

    Katlynne Jones

  • Hi , thanks for the explanation see this image I am setting channel A as an individual channel and making it (4.096) full range like 0001 1111 1111 1111, I am not using driver just normal SPI read write

  • Hi Varsha, 

    These screenshots look correct. So, there is a small glitch on the output when you send this, but the output does not go to full scale? 

    Is there a chance that you damaged the device on the EVM? 

    You changed the VA supply from 3.3V on the EVM to 5V, did you make any other changes from your original hardware configurations? 

    Best,

    Katlynne Jones

  • I changed supply but that was in range 3.3V to 5V and I check that the vref ic is giving proper output.

  • Hi Varsha, 

    So, there is a small glitch on the output when you send this, but the output does not go to full scale? Does the DAC respond to any commands at all? 

    Is there a chance that you damaged the device on the EVM? 

    Best,

    Katlynne Jones

  • Hi  , I am not sure its damaged or not but yes it does not have stable output. What are the other ways to confirm if there is IC damage ? 

    Does the DAC respond to any commands at all? -- NO same it has glitch and again 0.

    Regards,

    Varsha

  • Hi Varsha, 

    Considering that you were at least able to update the DACs with your original code (your first posts), and now you are not, I would think the part is damaged. The device is powered on by default. I would try power cycling the device and using your old code that changed the output to see if there is any activity on the output. If there is not, I would expect the part is damaged. 

    Best,

    Katlynne Jones