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.

TPIC8101 Advance SPI Mode??

Other Parts Discussed in Thread: TPIC8101

Hi All,

I have been working with the TPIC8101 chip and must admit am a bit frustrated.  1st in Normal mode all of my SPI commands are echoed as the data sheet indicates they should be -   including  the entry into the TPIC8101 advanced SPI mode.  However, the chip does not appear to be sensing (or at least reacting to the input signal).  I do get the stair step ramp output from the Analog pin - although it seems to be triggered by noise and not the signal.  I do not get any varying out put data from the SPi when I send it the Prescaler and Channel data as I would expect as a response if in the SPI advanced mode.

Finally in table 2 (Advanced mode), item no. 6 (Set SPI to advanced mode) indicates that if you are already in Advanced SPI mode and send the command code, tht rather than the echo back you get in normal mode for this command, you will get an inverted SPI configuration of 10001110 rather than response to the normal mode query of 1110 0001.

I send the Advance mode command (in normal mode) and get back the expected echo of 1110 0001.   Now the SPI mode should now be in Advanced Mode, so according to item 6 in table 2, if I send the Advanced Mode command again, I should get the inverse or 1000 1110 - however, I do not receive that so apparently the TPIC8101 never goes into SPI advanced mode, so that is why I never get data back from the SPI Prescaler - Channel commands.

So if the TPIC8101 echos all the commands I sent in normal mode - why does it not enter Advance mode when I sent it that command.

Any ideas appreciated

Thanks

Ed

  • Ed,

    In your first paragraph, it sounds like you are having trouble getting it to work at all, is this true even when using the normal mode for SPI communication?  What settings are you using?

    Are you using your own board and microcontroller?

    I'll take a look at the advanced SPI mode again tomorrow to see if I can offer you any advice that might help.

    Thanks,

    -Clancy

  • Clancy, thanks for the response.

    To be honest, I am not certain. With the TPIC8101 in Normal SPI mode, the unit echos in the returned byte response the same command I send it. From my understanding, this indicates that my microcontroller (PIC32MX795F512H) SPI and the TPIC8101 are communicating in normal mode.

    For example if I send the following to the TPIC8101
    Prescaler: 80 I receive the value 80 back and display it on my PIC32 LCD display
    sent received
    Channel : 224 224 (channel 1)
    BandPass: 30 30
    Gain: 130 130
    Ts: 222 222
    Adv Mode: 113 113

    My understanding is that the last command 113/0x71/1110 0001 should put the TPIC8101 into advance mode which is necessary in order to get the integrator output value via SPI. Well, as I mentioned, I am not getting any returned integrator output data.

    So that naturally raises the question as to whether the TPIC8101 is truly in Advanced SPI mode. Then I found item No. 6 in table 2 (top of page 14 in my data sheet) which indicates that if 113 is sent to the TPIC8101 when it has already been put into Advanced SPI mode then instead of the echo of 113 I got in normal mode, I should get an "inverted SPi Configuration (MSB) 1000 1110 (LSB).

    I send the 113 command after the board is powered up when the SPI mode is in Normal by default and I get the expected 113 response. However, when I send 113 again (when the TPIC8101 is supposedly in advance mode), I should get back 1000 1110/
    142, but instead get back the 113 indicating the chip is not in advanced mode which of course means I won't get data over the spi link.

    Yes, I do have my own board and microcontroller to answer your question. The board had been proven thought a number of units. The only thing different this time is I added the TPIC8101 and its components to the board.

    I do get analog output whenever I take the INTHOLD pin high for approx. 3msec and then low. The analogy output shows a 7 step ramp - however, it shows this whether a "Knock signal" is present or not - which I understand from other posts is normal. I am using a function generator to generate the knock signal a sine wave 300mpVPP which I can then modulate with a square, triangular or sine wave patter or no modulation at all.

    I have a OSC clock lead off my microcontroller resonator circuit which outputs a 200mv PP 24mhz signal to the TPIC8101. I have measure it at the pin to the chip and it is present. I have tried using both input channels and have measure the signal traces to make certain there is no broken connections.

    A very neat chip which would enhance my product to my customers - if I could just figure out what I am doing incorrectly. I can see the SPI clk, SDI and SDO traces on my scope and all looks normal to me.

    So if you can spare the time, I would greatly appreciate it.

    Here is a segment of code that I use to set the values for the various parameters into variables which are then sent via SPI to the TPIC8101


    //KS Utilities in SPI Advanced Mode - enter parameter value in decimal format
    Procedure Set_Prescaler(Parameter:byte);
    begin
    //parameter entered is freq in mhz of Timing clock input to TPIC8101 (24mhz in this case)
    //This assumes you want SDO of TPIC8101 active for SPI communciation
    case Parameter of
    4: PRESCALER_KS := %01000000 + %00000000; // 64 + 0
    5: PRESCALER_KS := %01000000 + %00000010; // 64 + 2
    6: PRESCALER_KS := %01000000 + %00000100; //64+4
    8: PRESCALER_KS := %01000000 + %00000110; //64+6
    10: PRESCALER_KS := %01000000 + %00001000; //64+8 = 72
    12: PRESCALER_KS := %01000000 + %00001010; //64+10 = 74
    16: PRESCALER_KS := %01000000 + %00001100; //64 +12 = 76
    20: PRESCALER_KS := %01000000 + %00001110; //64 + 14 = 80
    24: PRESCALER_KS := %01000000 + %00010000; //64 + 16;// PRESCALER := %01000000 + %00010000; //64 + 16 =80
    end; // case

    end;
    Procedure Set_CHSEL(Parameter:byte);
    begin
    if parameter = 1 then
    CHSEL := $E0; //Channel 1
    if parameter = 2 then
    CHSEL := $E1; //Channel 2
    end;
    Procedure Set_Bandpass(Parameter:byte);
    begin
    Bandpass := 0 + Parameter;
    end;
    Procedure Set_Gain(Parameter:byte);
    begin
    Gain := 128 + Parameter;
    end;
    Procedure Set_Ts(Parameter:byte);
    begin
    Ts := 192 + Parameter;
    end;

    Procedure SPI_Advance_Mode(Parameter:byte)
    begin
    Advanced_mode := 113;
    end;

    These values are sent as initialization and then an
    Display_Name := SPI_Read(SPIBUF); is used to read the PIC32 SPI buffer with the echoed value in it and display the response. A different display name for each variable the value of which is read immediately after the command is sent.

    The logic of the routine goes something like the following:

    SPI_Write(BandPass); //send command
    BandPass_Display := SPI_Read(SPIBUF); //read and store response value
    Display(BandPass_Display); which later displays the results

    I feel like I am close, but clearly missing something crucial

    Sincerely

    Ed
  • Hi Clancy,

    Based on a recommendation made by John Griffin back in 2011, it appears that my TPIC8101 is not entering the Advanced SPI Mode.  I mentioned note 6 in table 2 indicating I should get an inversed response if the chip was in Advanced mode  - which I did not.

    Then John suggested to another to send via spi 0x2A twice.  If the chip was in advanced mode then the second response should be 0x01, but I simply get back 0x2A once again indicating I am failing to put the chip in Advance mode.

    Apparently my Microcontroller and the TPIC8101 are communicating in normal mode in that I get an echo back of the command sent, so one would think that sending 0x71 would result in the TPIC8101 going into Advanced mode, but it does not.

    As I mentioned I do get the analog output when I cycle INTHOLD line, but it is about a 7 step ramp stair case from near zero up to Vdd (4.5V).  But, its clearly not being triggered by my input signal as I can remove the signal and still get the series of constant steps.

    I presume there is no source code available that might have a segment of code which is know to work?

    Best Regards

    Ed

  • Hi Clancy,

    I found this resolved problem on the forum:

    In reply to Clancy Soehren:

    Clancy

     

    please disregard - the 3.3V microcontroller was strobing the SPI bus - the power supply for the TPIC was 5.26V. The signaling level was outside the 70% of VDD

    for now we lowered the VDD of the TPIC to ~4.5V and it now works

    is 4.5V acceptable? - the spec is not clear on a min operating voltage

    It turns out my PIC32 microcontroller operates with a VDD of 3.3 volts, but I have 5 volts VDD feeding the TPIC8101.  However, it this were my problem, then I would suspect that I would get no SPI comm between my controller and the TPIC8101 - but, I do in normal mode.  I just can  not get it to go into advanced mode.  Nor does the analogy integrator appear to be responding to any signal input.

    Ed

     

  • Hi Clancy,

    All is well, I discovered I had two problems.  The first one I mentioned already, that the SPI_Write routine in my compilers Library appears to send two repeated commands - this appeared not to prevented me from displaying the returns - which echo the command as I expected.  But, it was apparently sufficient to prevent the TPIC8101 from going into Advanced SPI Mode and prevented me from getting the integrator's digital output via SPI.

    The second problem turned out to do with my clock input to the TPIC8101 - I had misinterpreted the placement of the resistor/capacitor conditioning components between my MCU clock and pins 9 and 10 of the TPIC8101.  Amazing how many times you can review something and not see the error.

    In any case, I am now getting both the analogy and digital output from the TPIC8101 and it is responding to the knock signal input as it should..

    You may marked this one as "Problem Solved"

    Thanks

    Ed

  • Excellent! I'm glad you were able to debug the issue. Please let me know if you have any questions I can help with.
  • Hi Clancy, yes me again!

    Well, made good progress with the SPI digitized Integrator output and am getting a response.  However, it appears that the TPIC8101 is not producing the D9D8000000 response in reply to the PRESCALER command - the response to the "Channel select" command in advanced SPI mode appears normal.  

    As I understand it, for a digital output from the integrator over the SPI, that the response to the PRESCALER command should be of the form D7-D0 (8bits). The response to the "Channel Select" command should be of the form D9D8000000.   Then this D9D8 value would be shifted left 2 bits and then combined with the response to the "PRESCALER" command to form the digitized voltage output value.

    However, as you can see below.  The D9D8 only ever shows 255 or 0.  When it should show 64, 128 and 192.  When shifted left 2 bits they then become 256, 512 and 768 when "OR" with the D7D0 values should give the end value.  But, I never get 64, 128 or 192, its just alternates between 255 and zero.  Its clear the chip knows when it is suppose to change the D9D8 values, but it appears to simply alternate it between 255 and 0.  It changes when it should, but it does not change to the values I expected 64, 128 and 192. 

    I printed the output for the responses to the PRESCALER and Channel Select commands separately so I could figure out why I was not getting the answers I expected.  The Analog voltage responses were also measure and were very close to those I calculated from the formulas in the data sheet, so it appears that part is working fine.  Its just the DA SPI response for D9D8 that does not seem to correspond to the data sheet.

    The numbers code in blue are the actual values I received over the SPI.  The red numbers are the ones I expected for D9D8 but only got alternating 255 or zero.

    I input varying sin wave amplitudes at a bandpass freq of 4.4Khz.  The analog values do decrease if I tune the function generator off of that center freq, in fact, everthing seems to be working correct, except the digitized ouput of the integrator.

    Ts = 180usec Gain = 1 Bandpass = 4.4Khz

    If you have any suggestions or if you have a TPIC8101 Test set up it would be nice to have this refuted or confirmed (for my sanity {:>)

    Thanks

    Ed

  • Hummm, seems like the jpg of the data did not come through on the previous post. I will try again

    Sorry 'bout that

    Ed
  • Ed,

    In response to your e-mail:

    First, the advanced mode appears to be specified correctly in the datasheet . Remember that the response is delayed by one byte, so if you are alternating between commands 1 and 2, the response will be delayed.  Maybe this example will help explain it:

    Send command 1 -> receive Null

    Send command 2 -> receive response 1 (D7-D0)

    Send command 1 -> recieve response 2 (D9-D8)

    Send command 2 -> receive response 1 (D7-D0)

    Send command 2 -> receive response 2 (D9-D8)

    For your comments about some data appearing too low, is this a repeatable measurement?  I did a sweep along the same area of interest as you, and did not see any problems.  Is it possible that you are sampling at the wrong time occassionally? 

    Thanks,

    -Clancy

  • Thanks, Clancy

    Yes, you are correct, I am alternating between Channel 1 and 2 inputs on the chip.  Thanks for clarifying the SPI protocol, I thought I had understood it but clearly did not.  I should be able to follow your simple example.

    I am going to assume that if you did not see the anomalies in SPI digitized integrator output - then it was most likely some error on my part.  If it shows up again, I will dig into it.

    Thanks again for you help

    Ed