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.

Buffered digital output.

Other Parts Discussed in Thread: HALCOGEN

Hi,

I'm working with a TMDX570LS32HDK.

For an ADC app I need to generate a digital waves pattern to feed ad setup my source. My digital pattern is constant through cycles of a single run but is NOT constant from an execution to another. It is someway similar to a serial signal but involves more signals. The pattern cannot be programmed and compiled on code generation because requires to be modified runtime.

The stardand way to generate a similar pattern would be a buffered digital output, where the application can fill the buffer and then start emitting cycling through the buffer at a predefined frequency. Every buffer bit is assigned to the state of a digital output pin.

Which is the bes way to achieve this?

There's somewhere an example to start with?

Thank you,

Matteo

  • Hello Matteo,

    I have some questions regarding your application.

    1.) Is the square wave pattern being generated by the TMS570 device as an input to an external ADC or is a pattern to be generated by an external source and fed into the TMS570 device and used as a trigger for the TMS570 ADC?

    2.) When you state "the digital pattern is constant through some cycles of a single run but is NOT constand from an execution to another" does this mean through each power cycle or during a finite period of time until the next need for conversion/event?

    In general, the N2HET on the TMS570 can be used to create a digital pattern output on one or more N2HET pins. As you have understood, this pattern is fixed based on the N2HET instructions. However, the HTU can be used to update the program content for changing the pattern generated dynamically. This can be done by breaking down the instructions in N2HET RAM into their components and updating the values that control the fields in question to change the behavior of the digital signal that is output. The basic structure of the N2HET RAM is a combination of 3x32bit words for Program, Control and Data fields with a 4th 32bit field that is reserved (so the N2HET RAM instruction falls on a 128bit boundary). There is more information regarding N2HET programming fields in the TRM. In addition, there is an example (example_hetPwm.c) included in Halcogen that will show how to generate a simple PWM with Halcogen.

    In regard to ADC triggers, this can be configured using Halcogen as well under the ADCx tab then under the chosen ADC group tab. The HET channels that can be used to generate the trigger will be subset of the available N2HET channels so whichever channels are used should be in the list of available triggers.

    Let me know if this information helps and, once we have a better understanding of your application needs, perhaps we can provide more specific information that will help you.

  • Hi Chuck,

    thank you for the answer.

    1) the square wave pattern is generated to feed an external source. One of the square wave must be used to trigger the TMS570 ADC too.

    2) during the acquisition one of the waves is someway similar to a serial signal, so its up/down state represents a sequence of digital value required to setup the external source. This signal does not changes along the multiple cycles of the same run but is required to change between different run. The change is setup via external (IP) command, so is not required to be fast, I don't think that should involves HTU.

    On a PC system this can be done (actually IS done) using a DSP board wich:

    a) is feed by a finite RAM buffer FIFO populated "offline" by the CPU code

    b) every sample in the FIFO represents the state of a group of DO pins (tipically grouped in 8 or 16 bit - pins)

    c) when started it cycles trought the FIFO at a given frequency reporting on the DO pins the values in the FIFO

    I'm investigating if a similar effect could be obtained by a TMS570, with the NHET or whatever device.

    For example: could the NHET code (or some other device) be used to read a memory value to replicate it in the DO pins?

    I don't think this can be achieved by the GIO which is software driven, so cannot run at a given precise frequency.

    I hope everything is clear (my english is not good as it should)

    Ciao e grazie,

    Matteo

  • Hi Matteo,

    I apologize for the delayed reply. I would like to take a bit of time to review the description of your application with my associates to discuss what the best solution might be. I will get back with shortly.

  • Matteo,

    Your pre-filled FIFO can be copied, one element at a time, to the GIO port data register using dma. This transfer should be triggered in hw at the frequency you want by a timer with dma request support(nHET) for minimum jitter.

    Joe

  • Hello Matteo,

    What frequency and duty cycle are you targeting with your application? i.e., what is the fastest signal/smallest pulse you need to be able to supply from the TMS570 device? Knowing this might help narrow the possible solutions for you.

  • Hello,

    actually the fastest frequency is 1MHz (and is the frequency of the ADC sampling too).

    Nevertheless with this new HW we'd like to increase it until 2MHz.

    Grazie,

    Matteo

  • BTW: can you give me some more detail about the GIO/DMA solution? There's some example or documentation about (I've seen nothing in HalCoGen).

  • Another easy way is to use MIBSPI5 with parallel pin option. With MIBSPI you can pre-fill up to 256 data points, up to 8 bits i/o and you get the timer for free (BAUD+DELAY TIIMERS) which can do 10X the rate than what you need. Mibspi is supported in halcogen and there are examples to use with dma if you want to extend your buffer depth. These are ideas, TI will help you with examples. You can dig up the examples faster.

  • Hello Matteo,

    This sounds like a good opportunity to NHET PWM generation. There is an online tutorial for configuring and generating code for a PWM using N2HE located at the following link:

    http://trainingcenter.ti.com/ti/training/cplayer?1&umfid=b3a35abe-7da5-4595-8d45-a4fbbd2cbb2b

    Once this is understood, you could approach the problem in 2 ways.

    The first option would be to use Halcogen to generate the code for the desired PWM frequency and duty cycle and, provided, the number of iterations of desired out are finite, you could repeat this so you have N2HET programs for each of the different outputs you would need. These N2HET programs could be loaded into N2HET upon need by re-initializing each time the output needs to change.

    If this doesn't satisfy the time requirements to start a new output stream, a second option would be to use the HTU to transfer the updated values into the N2HET memory/program when the output needs to change. This would allow for updating the N2HET program quickly/real-time.

    If the output frequencies are not finite and are derived from some external communication or input, then you would have to update the fields that define the frequency and duty cycle with the calculated or derived values from your input assuming you couldn't keep these as entries in a lookup table.

  • Hi Cuck,

    i'm afraid that the solution you propose is not feasible. One of the output train is something like a serial signal, so is not a simple waveform definded by duty cucle and frequency. Every oup/down state in this signal represents a bit value (exactly like a signal on a serial cable) and the complete information is 256Byte wide. So I don't trust that :

    - the het can generate a so iregular wave

    - cannot write het programs for every possible combination (would be 256^256 programs!)

    What about the GIO/DMA and the MIBSPI5  solutions proposed by J.Jonson?

    I'm going to investigate this ways but would appreciate some suggestion/example/opinion too.

    Grazie,

    Matteo

  • Matteo,

    The N2HET is very versatile. Although a varying pulse width complicates things, it is still possible. We have examples of SCI, I2C, and SPI using N2HET. I will locate and provide links to these later today.

  • Matteo,

    I have asked one of our N2HET experts to have a look at this thread so he can provide his inputs. Generally speaking, what you describe is an ideal application for the N2HET and HTU combination of peripherals. He will be able to elaborate further and perhaps be able to help generate an example project for you to help with this task.

    In the mean time, you may want to check some of the app notes for the Hercules products located at the following link since I think there is quite a lot of useful information for you in these documents.

    http://www.ti.com/lsds/ti/microcontroller/safety_mcu/tech_docs.page?rootFamilyId=4&familyId=1931&docCategoryId=1

    In addition, you may want to see the following thread where we discuss using N2HET as a full duplex UART.

    http://e2e.ti.com/support/microcontrollers/hercules/f/312/t/229245.aspx

     

     

  • Chuck, Looking at TRM (SPNU515-for 1227), SPI Data Format register bit 19 (Half Duplex En) - says it enables all rx pins as o/p in slave mode. Is that correct?

  • Hello J Joson,

    I have reviewed this section of the TRM and you are correct in that the Rx pins are changed to Tx in Half Duplex mode. However, my understanding is that the normal Tx pins are then ignored but I am not 100% certain of this. I have asked our design team to look at the source code for this feature and add some clarity regarding the implementation. I will get back to you when I hear back from them.

  • Hello Matteo, J Joson,

    The N2HET support GIO function for each pin on top of micro-codes that can be written to change the pin.

    Please refer to section 19.2.5.1 and 19.2.5 for more information.

    This is our assumption of your application:

    • "sounds" like you have the FIFO width (from 8 to 16 bit with "each" bit corresponding to a state ON / OFF of "a" pin).
    • Assume that you launch serial data on one edge and capture the serial data on the opposite edge.

    If this is the case, you can configure N2HET pin (e.g. 0..15) for GIO function.

    (MIBSPI/GIO may not give you up to 16 pins GIO functionality)

    You can program DMA to read from FIFO and write directly to DOUT register (8 bit or 16 bit ).  

    There are DMA example codes on this forum.

    Please ensure that the DMA element size is either 8 or 16 bit so that you do not corrupt the remaining bits in DOUT register as they are protected by byte enable on the bus.

    This way, 8 or 16 N2HET pins will toggle according to your individual bit value.

    I also see that you mention about ADC S/H triggering.  Not very sure on how you sync up ADC triggering and your serial bits.

    But you can write simple N2HET codes to trigger ADC S/H on non-serial pins.  

    Hope this helps.

  • Hello Henry,

    this sounds like the right solution for my problem.

    Which document do you refer to writing "Please refer to section 19.2.5.1 and 19.2.5 for more information."? I have the TMS570 technical reference (spnu499) but chapter 19 is about  ADC, I guess thwe right chapter were 20.2.5 (NHET I/O control) and 20.2.5.1 (Using Generalo porpouse I/O Data SET anc clear register). Right?


    About the setup starting a new test project in halcogen:

    - Enable HET1 driver

    - Enable HET1 in PinMux Table

    - Set output direction for pin 0-7 in HET1/Pin0-7 table

    Then in CCS5 i add the code to write to enable DMA from sysbuffer to hteREG1->DOUT (based on your mbspi-DMA example) that basically set DMA control packet, enable DMA.

    Do I forget something on the halcogen setup?

    There's something outside halcogen to be done?

    Where can I set the DMA frequency? (wich timer do DMA REQ uses?)


    Thank you,

    Matteo


  • Hello Matteo,

    I assume the issue being discussed in this thread has been resolved due to the length of time it has not had any activity. As a result, it will be closed. If there are any additional or new questions related to this discussion, I encourage you to start a new thread.