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.

Real Time Input/Output DSK6416

Other Parts Discussed in Thread: ADS1174, DAC8554EVM, DAC8554, ADS1274

Hi,

I have built a system with a DSK6416 + 5/6 Interface Card + ADS1174EVM + DAC8554EVM. I am now able to input values with the ADS1174 and output them with the DAC8554. I set up the receive and write interruptions of the McSBP ports and create a couple of functions that read the values and output them. The code is like this:

void getMCSBPData(void){ /*function to execute when reading interrupt McBSP port 0*/

data=MCBSP_read(hMcbspADS1274);

}

void writeMCSBPData(void){ /*function to execute when writing interrupt McBSP port 2*/

MCBSP_write(hMcbspDAC8554,data);

}

This is the basic code I am using now (some control flags for synchronization are used but the should not interfere).

I would like to be able to do this operation in Real Time. Right now, I have a minimum delay between the input and the output of 1.5 ms.

If the ADS samples at 50000 samples/s and with 4 channels, i should be able to get a delay of just 1/12500 s (considering that it samples the 4 channels and there is only one sample delay).

Is there a way to improve this and make it shorter (closer to Real Time)?.

Thanks,

  • Ivan,

    You have put together a very fine and capable system. It will allow you to do many things in the world of Digital Signal Processing.

    Since you are writing very simple routines and trying to just get data from an input to an output, it is clear that this is your first step through a process to develop a fully functional system. As I see it at this point, you are trying to benchmark the system to figure out how fast it will work.

    My suggestion is to go through the training material on our Wiki site of the archived TMS320C6x1x DSP Integration Workshop. This Wiki page includes the student guide and the labs used in the class, with solutions. You will learn the simple methods and then the best methods to transfer analog signals, as well as programming methods to achieve real-time processing.

    It is not obvious from your post above whether you are using BIOS. Are you?

    If your A/D is sampling at 50K SPS, there is no way you can achieve a 1.5 ms skew between input and output in the DSP. You have no data buffer, so you cannot store more than 1 sample, and that will be written out at the next transmit cycle. If you are in fact sampling at 50K and you do have a 1.5 ms skew, it is not from the DSP. You may want to look at the A/D and D/A to see what filtering delays are implemented in those devices.

    I do not follow your logic getting from 50K SPS to 1/12500 s delay. I do not believe the 4 channels should matter, but then I am not sure if you are sending the same data out on all 4 channels or inputting the same signal on all 4 channels, or how it is working.

    Regards,
    RandyP

  • Hi Randy,
    You are right. The idea of all this is to have a system that acquire signals, process them and output them in Real Time. By processing I mean to do things like delays, filtering, Hilbert transforms…
    I have gone through the training material and examples which are very interesting and valuable. Regarding your question of if I am using BIOS, the answer is YES. I have configured the interruptions with BIOS and also some of the parameters of the DSP board.
    The 1/12500 delay I say it because the ADC samples from all 4 channels. I am only using one channel now so given that the device works at 50K SPS I get a sampling rate at channel 1 of 12500. So basically we could say that my sampling rate is 12500 SPS.
    I changed yesterday my code and reduced the number of interruptions to one. Now, only the receive interruption of the McBSP port is activated and in the ISR reads the value, and send it to the other port to output through the DAC.
    The code is like this.


    #include "dc_conf.h"
    #include "t8554_fn.h"
    #include "t1274_fn.h"
    #include "tidc_api.h"

    #include <stdlib.h>
    #include <stdio.h>
    #include <math.h>

    #define BUFFER_SIZE (50000)
    #define MAX_ADC 1700000
    #define MIN_ADC -1700000

    unsigned int seno[BUFFER_SIZE];
    int r_buffer1[BUFFER_SIZE];
    unsigned int r_buffer2[BUFFER_SIZE];
    int ii=0, jj=0,countDAC=0,countADC=0,fchannel=0;
    float value=0;
    TDAC8554 *pDAC;
    TADS1274 *pADS;

    void TransferFinished(void* pDac);

    void main (void)
    {
    unsigned int i,

    pADS = (TADS1274 *)(&Ads1274_1);
    pDAC = (TDAC8554 *)(&Dac8554_1);

    /* make the McBSP1 available to the daughterboard connector */
    *(unsigned volatile char *)0x60000006 |= 0x03;

    for (i = 0; i < BUFFER_SIZE; i++)
    {
        r_buffer1[i] = 0;
        r_buffer2[i] = 0;
    }


    /* allocate resources and put converter in power down mode */
    if (dc_configure(&Dac8554_1) != TIDC_NO_ERR) {
        fprintf(stderr, "\nError: DAC8554 configuration failed!\n");
        dc_close(&Dac8554_1);
        abort();
    }
    if (dc_configure(&Ads1274_1) != TIDC_NO_ERR){
        fprintf(stderr, "\nError: ADS1274 configuration failed!\n");
        dc_close(&Ads1274_1);
        abort();
    }

    IRQ_globalEnable();
    IRQ_enable(IRQ_EVT_RINT0);

    while(1);

    }

    void getMCSPData(void){
        if (jj>=BUFFER_SIZE)
            jj=0;
        r_buffer1[jj]=MCBSP_read(pADS->serial->hMcbsp);
        if(fchannel%4==0){
            r_buffer2[jj]=(unsigned int)((((float) r_buffer1[jj])/MAX_ADC+1)*(65535/2));
            MCBSP_write(pDAC->serial-hMcbsp,DAC8554_DEVALL_WR_ALL_LD_ALL|r_buffer2[jj]);
            countADC++;
            jj++;
        }
        fchannel++;

    }

    I do not know if the code inserted int he ISR (getMCSPData) could produce the delay, what do you think?. I scale the values in the range of the ADC before output them.
    Would the use of EDMA reduce the delay? In my opinion, the DSP speed is high enough to cope with such simple operations without having a delay.
    Regards,
  • Grtns,

    Just a note in here.  You said you are using DSP/BIOS to configure your hardware and likely the interrupt dispatcher, except your main in hanging at

    while(1);

    and not activating BIOS.

    To use DSP/BIOS, you need to return from main to drop into it (the way _c_int00() is setup to start the system).

    To use SYS/BIOS, you need to call BIOS_start();

    Good Luck,

  • Ivan,

    Re-phrasing my earlier reply may help, but if not, then I completely understand.

    The training materials and examples should be used for guidance in writing your program. Using them in this way would have avoided the errors that Sam Kuzbary pointed out.

    The code inserted in the ISR cannot produce the delay. Your program is not capable of delaying the signal by 1.5ms. Look at the A/D and D/A datasheets to understand where the delay is coming from.

    The EDMA is a good choice to use for servicing a peripheral such as the McBSP. But it could only improve your delay by one sample time.

    A sample time is 1/50000, not 1/12500. Each channel is sampled at 50K SPS.

    I hope some of this makes sense and that some of it will help you. Good luck!

    Regards,
    RandyP

  • Grtns,

    Somewhere in main, there should be a

    DSK6416_init();

    which will be handling all necessary init to your DSK for anything other than POR default.

    Such can be found in training materials or example projects that comes with the DSK.

    Good Luck,