Using SDI with Embed

Markus_20691
Markus_20691 Altair Community Member
edited March 9 in Community Q&A

Dear Altair Embed Support Team,

I have a more complicated question:

My goal is to interface an ADC (ADS8555EVM-PDK from TI) by reading the results with the TI-Launchpad-F28069M. Currently I am achieving this by using a finite state machine which is reading the bits in parallel-mode. I am currently reading 3 channels (one after another) and I get a data rate of around 5kHz  which is not so fast.

The ADC has a SDI output.

So I want to know, if Embed provides a programed solution for interfacing of

the ADC over the SDI-port. I ask because than I would read the data over the SDI-port which is hopefully a lot faster.

I attached the documentation of the ADC.

 

Again thank you for your help.

 

Kind regards

 

Markus

Tagged:

Answers

  • Anthony Boon_20414
    Anthony Boon_20414
    Altair Employee
    edited October 2023

    Hi Markus,

    You should not have any issue in using the ADC up to its full data rate of 500ksps in serial mode. I see that the ADS8555 has up to 3 output channels at the maximum data rate. You are using the F28069 launchpad. This MCU has only 2 SPI interfaces but there is a McBSP interface which can be configured in Embed as an additional SPI interface for the 3 output channels.

    You may consider another TI C2000 MCU such as the F28379 launchpad which has 3 high-speed compatible SPIs available and with 16-deep FIFOs rather than 4-deep FIFOs of the F28069 SPI peripheral. This can reduce the required CPU resources somewhat but the F28069 can also be successfully used with the SPI interrupt enabled and an appropriate software queue size. The SPI bit rate required at 500ksps would be 500 x 16 = 8MHz which is within the limit of 25MHz for the F28069 SPI peripheral in master mode.

    You should be able to obtain the maximum ADC data rate using the SPI interfaces and can run your diagram at a much lower rate depending upon the FIFO and / or interrupt software queue depth.

  • Markus_20691
    Markus_20691 Altair Community Member
    edited October 2023

    Hallo Anthony,
    thank you for your response.
    Which blocks do I use for that? 
    Could you provide an example on how to implement that in Embed?
    If I get you right: For reading the SDI-Ports, SPI is necessary?
    Which ports are necessary on the ADC-side (for one channel) and which ports are used on the MCU-side?

    Again thank you for your help.

    Kind regards 

    Markus

  • Anthony Boon_20414
    Anthony Boon_20414
    Altair Employee
    edited October 2023

    Hi Markus,

    For ADCs that have a parallel interface, they are usually suited to FPGAs or to other MCUs with a larger pin count and a dedicated parallel communication interface such as the TI C2000 Delfino. With devices like the F28069, you should use the serial interface of the ADC.

    I have not looked into the ADS8555 in detail but the serial communication should be SPI compatible. There are hardware pins on the ADC to select the select serial mode. The SPI SIMO should be connected to the ADC SDI pin, the SCLK to the XCLK pin, the STE/ to the FS/ pin and the SOMI to the SDO pin. The MCU forms the SPI master.

    The blocks to use in Embed are the SPI blocks under Embedded --> Piccolo:

    image

    image

     

    You would need to determine the details from the ADS8555 data sheet on how to communicate through the serial interface including the configuration necessary and the word order for each internal ADC. There are timing diagrams in the ADC datasheet to assist with the different modes.

  • Markus_20691
    Markus_20691 Altair Community Member
    edited November 2023

    Hallo Anthony,
    thank you for your response. 
    In your email you show the write-block.
    I would like to know, if the write block is necessary for the communication? 
    I thought the read block would be used for reading the signals from the ADC.
    Is the write-block necessary to start the SPI-communication or something else is needed to do so? 


    Again thank you for your help.

    Kind regards 

    Markus Fromm

  • Anthony Boon_20414
    Anthony Boon_20414
    Altair Employee
    edited November 2023

    Hallo Anthony,
    thank you for your response. 
    In your email you show the write-block.
    I would like to know, if the write block is necessary for the communication? 
    I thought the read block would be used for reading the signals from the ADC.
    Is the write-block necessary to start the SPI-communication or something else is needed to do so? 


    Again thank you for your help.

    Kind regards 

    Markus Fromm

    Hi Markus,

    The blocks were intended as just an example of the SPI blocks. You are correct that the SPI read blocks will be required for reading the data from the ADC. However, the ADC normally has a configuration register which can be written to using the SPI write block.

    In order to start the ADC conversion, some ADCs are required to be written to over the SPI. You would need to check your ADC datasheet to confirm this for your selected ADC.

    Why are you using an external ADC rather than using the F28069 internal ADC?

    Anthony

  • Markus_20691
    Markus_20691 Altair Community Member
    edited November 2023

    Hello Anthony, 
    thank you for your answer.
    We need, for our current project, an ADC with a range of ±10V.
    Therefore the ADCs on the F28069 are not suited.

    Kind regard 

    Markus

  • Anthony Boon_20414
    Anthony Boon_20414
    Altair Employee
    edited November 2023

    Hello Anthony, 
    thank you for your answer.
    We need, for our current project, an ADC with a range of ±10V.
    Therefore the ADCs on the F28069 are not suited.

    Kind regard 

    Markus

    Hi Markus,

    Usually in this case, if the input signal amplitude is the only issue, then I would feed the input signal into the internal ADC via an opamp driver with a gain of 1/6 and an offset of 1.65V for the full signal to be read by the ADC from 0 to 3.3V. The opamp can also be your anti-aliasing filter.

  • Markus_20691
    Markus_20691 Altair Community Member
    edited November 2023

    Hello Anthony, 
    We tried to launch the SPI-communication. 
    Unfortunately there is absolutely no reaction from SPI-interface.
    Is there anything else I can do to force a SPI-communication?
    Is a separate conversion impuls necessary?
    I attached the current diagram we are using.

    Kind regards

    Markus

  • Anthony Boon_20414
    Anthony Boon_20414
    Altair Employee
    edited November 2023
    Hi Markus,
     
    It is not clear from your example diagram what you are trying to do. I do not see that you are sending anything to the external ADC chip. There should be a way to send a start of conversion unless the chip can be preset for continuous conversion. I do not see any configuration settings being sent of the SPI communications. Have you set up everything using only the ADC hardware pins only?
     
    I believe that the TI datasheet and / or any TI application examples for the device needs to be studied further.
     
    For the HIL diagram, you are trying to run it at a 20MHz rate using a 90MHz clocked CPU and in real-time. It is sufficient to run the target diagram at around 100Hz rate (System --> System Properties) which is an  acceptable rate for transferring all the data you need over the JTAG communication interface of the HIL diagram. The target sample rate in the target interface block should run at your desired ADC sample rate or lower (maybe 1kHz is normally sufficient but if you want to view all the data, you should connect the SPI read block output to a monitor buffer rather than to an output pin and read the monitor buffer in the target diagram). In the example diagram it is set up to read a SPI 16-bit word at a 20MHz rate but the SPI bit rate is 5.625MHz. Note that as your diagram is currently set-up, it will try to read a SPI word at every tick of your routine but you need to wait until a word has been received in the SPI hardware buffer of the MCU. 
     
    I feel that you need more understanding of the SPI interface and you can refer to the SPI section of the TI Technical Reference Manual of the F2806x for this. In the Digital Power Designer add-on to Altair Embed, there is a simulation example of how the SPI interface works bit by bit, when communicating to a DAC7554 under Digital Power --> Examples --> Simulation --> MCU Peripherals -- SPI Master to DAC.
    There are SPI examples for the F28069 under Examples --> Embedded --> Piccolo --> SPI.
     
    Anthony
  • Markus_20691
    Markus_20691 Altair Community Member
    edited November 2023

    Hello Anthony,
    thank you for your response. 
    Unfortunately the example-diagrams didn't help.
    We tried to get a signal out of the SPI-clock. We monitored the GPIO18-PIN with an oscilloscope but without any success.
    Therefore I would like to know, if there are other sources that could help us to understand the SPI-Interface in Embed and how to use it. 
    If it is possible I would like to ask for another simple example that would help us to understand SPI in Embed. 
    Again thank you for your help.

    Kind regards

    Markus

  • Anthony Boon_20414
    Anthony Boon_20414
    Altair Employee
    edited November 2023

    Hello Markus,

    If you have configured the SPI correctly and send out a data word on the SPI then you must get 16 clock cycles on the SPI-CLK pin.

    Can you attach your latest diagram?

    Anthony

  • Markus_20691
    Markus_20691 Altair Community Member
    edited November 2023

    Hello Anthony,

    I attached the diagram. We tried everything (even the SPI-examples) but without any reaction of the Launchpad.
    Our goal is to read one channel of the ADC via the SPI interface (for the start with a low clock-rate).
    We are trying to write the reading-results into the buffer block but unfortunately we didn't get any reaction from the Launchpad.
    Could you provide a working diagram?
    Again thank you for help

    Kind regards

    Markus

  • Anthony Boon_20414
    Anthony Boon_20414
    Altair Employee
    edited November 2023

    Hi Markus,

    I will list some of your issues here.

    For the target interface diagram:

    1. You have a compound in your diagram and I don’t understand what are you doing with it. Has it been compiled for the target? I don't see how you are using the compiled .out file for your target F28069.
    2. There is no target interface block in the diagram. To load a compiled .out file onto the target, you need to place a target interface block in the diagram. This will be automatically populated with the last .out file that you compiled. Otherwise, you can change it in the internal dialog.
    3. In the compound block, you are trying to trigger the monitor buffer at a 1kHz rate but the diagram (and therefore also the compiled file) is set to run at only 100Hz. It cannot see the trigger at this rate as warned by the pop-up when trying to run the diagram. When you trigger a monitor buffer, it will fill up the buffer at the target execution rate (100Hz) so that your 100 samples in this case will take 1 second. The fastest rate at which you can trigger the monitor buffer in this case is therefore 1Hz. The monitor buffer can be triggered again when it is empty after it is read out in the target interface diagram.
    4. You are placing a SPI read block and trying to read it at the full target execution rate (100Hz), but you are not checking that there is anything present in the SPI buffer to be read.
    5. To know that your routine is running on the microcontroller, I recommend to include a heart-beat LED in your diagram.

    For your ADC operation:

    1. I believe that you need to study your datasheet of the selected ADC further. How are you initiating a start of conversion of the ADC?
    2. I do not know how you have connected your ADC in hardware. Are you intending to use hardware mode or software mode? You need to configure for serial mode as well in this case.
    3. Check which ADC pins the microcontroller SPI pins are connected to.
    4. I see that you have configured your SPI interface as the master. This means that the microcontroller will provide the clock for the ADC. You must configure this in the ADC. Please refer to your ADC datasheet. The Frame Synchronisation (FS) will be given by the SPI-STE/ output pin of the microcontroller. The timing diagram for the serial interface from the datasheet is here:image
    5. In order to read a word on the SPI interface, you need to select the ADC and send the clock to the ADC (i.e. the master must transmit a word) and your slave device will send out its data on the clock edges as configured in the SPI interface. This must be compatible with the ADC datasheet. Any serial data input to your ADC is latched at the falling edge of the clock. Your ADC also has an internal clock and it may be able to operate as the master (check this if necessary). Again, I emphasise that you study the TI Technical Reference Manual for the F28069 in the SPI section, to see how the SPI peripheral functions.

    An example diagram addressing some of these issues is attached.

    Why this ADC?

    1. You have written that the reason for selecting this ADC is for the +/-10V input capability. I do not understand why you need an external ADC for this. I commonly use the internal ADC of TI microcontrollers for measuring voltages greater than +/-1000V and also for measuring mains voltages.
    2. Below is a simple circuit to achieve this for +/-10V input as you specify:

    image

    This circuit is much simpler in hardware and cheaper to build than using an external ADC. It is also significantly easier to program and more efficient in the microcontroller and only requires reading the internal ADC in your diagram as below:

    image

    with the ADC configuration as:

    image

    Anthony

  • Markus_20691
    Markus_20691 Altair Community Member
    edited December 2023

    Hello Anthony,

    thank you very much for your detailed answer and the VISM-diagram.
    I tested the diagram and there was reaction on the data Pins (SOMI and SIMO) but unfortunately no data from the ADC (while reading the results back).

    I want to answer the five points regarding the ADC:

    I think, when I want to use the SPI-Bus, I need to initiate the conversion by sending a command to the ADC-register (in software-mode). That means, I need to start the conversion by writing into the control register. I think there is no other way if I want to read back the results of a conversion via SPI (Or is there another simpler way in hardware-mode?).

    I want to use the pins you mentioned in an email before:
    SDI, SDO, XCLK, FS/CS of the ADC. (And for the Launchpad: SIMO-, SCLK-, STE- and the SOMI-Pin)

    I read the documentation of the ADS855 and I figured out, that I need to write the following bits into the register while writing.

    C29 = 1 (Channel pair A enabled)
    C23 = 1 (Sequential convert start mode enabled (bit 11 must be 1 in this case))
    C11 = 1 (External conversion clock (applied through pin 27))

    That means, that the following bit-order needs to be transmitted first: 0010 0000 0100 0000 0000 0011 1111 1111b or in a hexadecimal: 0x0204 03FF, if I am not completely wrong.

    image

    After that, I want to read back the result of the ADC.
    Is this necessary or is there a much simpler way to start the conversion and read back the results via SPI?
    In the end I would prefer the most simple way to read back the results over the SPI-Bus.
    I attached the VISM-diagram with bit-order I want to transmit.

    Again thank you very much for your help.

    Kind regards

    Markus

     

  • Peter Darnell
    Peter Darnell
    Altair Employee
    edited December 2023

    Hi Markus,

    there are a few problems with your diagram:

    image

    You use a large hex number in a 16-bit fixed point const block to send as a 16 bit data via SPI. 

    1) That block requires normal decimal notation, not hex. For hex # entry you can use a regular const block and prefix the hex# with 0x as shown above.

    2) you must send out 2 16-bit values in separate SPI TX blocks to send 32 bits of info via SPI. The 2 regular const blocks each containing 16-bit hex halves of your 32-bit hex number are shown in the screen shot above.

  • Peter Darnell
    Peter Darnell
    Altair Employee
    edited December 2023

    By the way, I would definitely use Tony's circuit above to adapt an external voltage above 3v3 to the ADC range of the F28069 . This lets you use the on-chip ADC unit on the F28069 (or any other MCU), which greatly speeds up the ADC acquisition time and ease of programming.

    He has supplied a differential dual channel circuit which gives better noise immunity than a single ended channel.

  • Anthony Boon_20414
    Anthony Boon_20414
    Altair Employee
    edited December 2023

    Actually, the proposed circuit above is still single-ended as far as the measurement is concerned and as such does not improve the noise immunity that much. The dual-channel sampling was proposed because the signal to measure is a dual-polarity signal of +/-10V. A mid-point reference is created using the normal supply voltage rather than using an accurate reference source and this mid-point voltage will vary depending on the supply regulation and temperature. The mid-point voltage is therefore sampled at the same instant (dual-sampling enabled) as the input signal, on a single ADC trigger (SOC). The mid-point voltage conversion result is then subtracted from the input signal voltage conversion result in the software to give the actual dual-polarity measurement.

    If more than 8 ADC channels are required with dual-sampling, then a more accurate voltage reference would be required for the mid-point reference. In either case, dual sampling will improve the accuracy of the measurement, along with oversampling.

    The F28069 has a single ADC but has dual samplers. In later TI devices, there are multiple internal ADCs, each with its own sampler. In this case a single trigger is sent simultaneously to two different internal ADCs; one ADC converts the input signal voltage while the other ADC converts the mid-point reference voltage with simultaneous results put into the configured result registers (ADCRESULTx).

    Anthony

  • Markus_20691
    Markus_20691 Altair Community Member
    edited March 9

    Hallo Anthony,

    I would like to say thank you for your relentless help to you and the Altair community.

    The project was a success. The interface and the evaluation of the ADC worked thanks to your given
    tips.
    Please keep up this great help.

    Kind regards, 

    Markus