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.

TMS320C5535: Getting an analogue square signal out from the DSP

Part Number: TMS320C5535

Hello,

I am working on a project with the C5535 and I read on the datasheet that I can get an analogue output signal via the GPIO pins, but I do not know how. Could someone help me with the code that I would have to write in order to get a square pulse from a pin on the C5535, in fact, it doesn't have to be by the GPIO pins necessarily, any pin or terminal I could get a signal from is fine. The purpose is to work with that analogue signal on a PIC afterwards.

I'd appreciate your help.

Sincerely, Osmar.

  • Hi Osmar,

    The simplest answer is that you can only get boolean values (high/low) from the GPIO. So in order to get analog data you need to use external ADC module in your project.
    There is a possible hint about reading analog sensors with GPIO which is described at:
    www.raspberrypi-spy.co.uk/.../

    BR
    Tsvetolin Shulev
  • Hello Tsvetolin,

    This boolean values, can I get them out from the DSP into another device, for example; a PIC microcontroller? Do they oscillate between 0v and 1v or something like that?


    Osmar
  • Hi Osmar,

    Yes you can wire one of the GPIOs to a PIC microcontroller assuming it can operate at the same IO voltage. Dont forget to connect the GND references together also.

    The GPIO will toggle between 0V and the voltage that is supplied into DVDDIO supply (usually 1.8V or 3.3V, but 2.5V and 2.75V are also allowed).

    On the C5535 eZdsp board, 3.3V is supplied to DVDDIO so every GPIO will toggle between 0V and 3.3V.

    There is example code of toggling a GPIO in the CSL examples: http://www.ti.com/tool/sprc133 

    After installation, find the example under <install path>\c55_csl_3.07\ccs_v6.x_examples\gpio\CSL_GPIO_OutputPinExample\

    Hope this helps,
    Mark

  • Mark,

    Thank you very much for your contribution. I actually took a look at that example code, but it seems a little bit complicated for me to implement... You see, I am not very good at coding, and what I am trying to do is to add, if possible, a command line to an already existing code I have that is also an example code from TI.

    So I was wondering if there was a particular command that would let me create such an output signal in an already existing code.

    Is there a way to do that?

    Sincerely, Osmar
  • It is probably easier to connect a wire from a GPIO. And the CSL code can be reduced to a few register writes if you look at the TRM. However, it is easier and preferred for us to support CSL-based software on this e2e forum.

    Maybe you can start with the XF pin which is basically a dedicated GPO pin (output only).

    On the C5535 eZdsp, the XF pin is connected to LED DS2. You can watch it blink, and then perhaps solder a wire between the LED (or R17) to the PIC input pin.

    Something like should make it toggle.

    //// top of file
    #define DELAY 32000
    Uint16 i;
    //////

    while(1){
    asm(" BCLR XF");   //Set XF ouput low

    for(i=0; i< DELAY; i++)
    {
        asm(" NOP");  //wait some delay
    }

    asm(" BSET XF");   //Set XF ouput high

    for(i=0; i< DELAY; i++)
    {
        asm(" NOP");  //wait some delay
    }}

    If when you build your project, it complains about using algebraic assembly instead of mnemonic assembly, then use these assembly calls instead...

    asm("    bit(ST1, #ST1_XF) = #0");   //Set XF ouput low
    asm("    bit(ST1, #ST1_XF) = #1");   //Set XF ouput high

    Hope this helps,
    Mark

  • Mark,

    I am sorry, what do you mean by connecting a wire from a GPIO. Also, what is the TRM?

    And to the XF alternative, isn't there a less invasive solution to get that pulse so I don't have to solder anything to the board?

    Sincerely, Osmar