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.

ADC max sampling frequency limited by SYSBIOS?

Other Parts Discussed in Thread: SYSBIOS, TMS320F28335

Hello. I'm using a TMS320F28335. I need to obtain a sampling frequency of 400KHz for the ADC but using SYSBIOS the maximum rate I can read the ADC values is at not much more than 1KHz. My cpu usually runs at 150MHz but I don't know if SYSBIOS configures it to another frequency or does something odd. Could it be just limited by the length of the code? I'm not using interrupts, just a while loop to wait for the values of the ADC since I need to execute some code before the next reading. Any idea?

thank you!

  • Carlos,

    To clarify… have you configured the ADC and then polled it without using SYS/BIOS, and have seen a much higher access rate?

    If the ADC samples should be ready without any delay, and you can only poll the ADC at 1KHz, then it sounds like the CPU must be running very slowly.  How do you normally set the CPU speed to 150MHz?  Is that code still being invoked when you run with SYS/BIOS?   

    Also, what version of SYS/BIOS are you using?

    Scott

  • Hello Scott. I'm using version 6.32.02. At first I wasn't using any RTOS and yes, the frequency getting the data from the ADC polling it was much higer (I think it could be around the 300KHz maximum). Then I started using the SYSBIOS since I wanted to create some tasks running with the same priority. Next thing was that I have to measure the RMS value of a sinusoidal 20KHz waveform, so I need to sample it as fast as possible, I thought about like 400KHz since the ADC doesn't admit negative values and I prefer just to sample the positive bump rather than use a full bridge rectifier. What was my surprise is that the data was aquired at 2KHz or 3KHz aprox.  I know that cause I toggle a GPIO output right after I get the ADC values. About the CPU configuration, I have never done it, it comes from default but at least without the SYSBIOS it was 100MHz or 150MHz configured. How do I know the frequency it is configured for?

    Thank you.

    Carlos

  • Well I just was taking a look at  the "DSP2833x_SysCtl.c" and "DSP2833x_Examples.h" files and I could see that the CPU is configured with a 150MHz frequency so, as long as the SYSBIOS doesn't modify this, I don't see any other reason the CPU is working at lower freq

  • Carlos,

    Can you also tell me what XDCTools version you are using? 

    There is a “Boot” module (that comes with XDCTools) that can optionally be used by SYS/BIOS to do some boot time initialization (immediately after reset), like disabling the watchdog, setting up the PLL, etc.  Depending upon your configuration, this may or may not be enabled. 

    There is a description of the startup sequence and the Boot module here: http://processors.wiki.ti.com/index.php/SYS/BIOS_for_the_28x#Boot_Sequence_with_SYS.2FBIOS But this description is for more recent versions of SYS/BIOS, and all may not apply for your case.

    You mention "DSP2833x_SysCtl.c" and "DSP2833x_Examples.h".  In your application are you making calls to these to initialize the device?  If so, this will come later after what Boot might be doing, and override the setup that may have been done in Boot.

    The other thing that may be going on is the settings for wait states.  Are you setting these up properly for the CPU running at 150MHz?  These are usually not setup by SYS/BIOS, but need to be setup explicitly by the application.  The only boards I now of where this is handled automatically are the ezdsp28235 and ezdsp28335, for setting up XINTF.  If your application is built based on the platform “ti.platforms.ezdsp28335”, then XINTF wait states should be set automatically.  If this option is disabled, or you are on different hardware, then this might be the cause of the slow execution?  

    Scott

  • Thanks Scott. I assume that I'm configuring correctly the CPU to work at 150MHz since in the "...Examples.h" file I can see the next line of code:

    #define CPU_RATE    6.667L   // for a 150MHz CPU clock speed (SYSCLKOUT)

    The other defines for other rates are commented and that's the one used for the configuration. I'm using the TMS320F28335 so nothing about the automatic configure. If the SYSBIOS is not configuring itself the cpu clock then my guess is that this RTOS slows down the execution of my code a lot.

  • Carlos,

    I don’t know what is in your application, or in that Examples.h file.  What code uses that “CPU_RATE” define?  Is it still being invoked when you run with SYS/BIOS?  If there is no code initializing the PLL then you are probably running at a slow default rate.

    It doesn’t sound like you are using any SYS/BIOS services, or interrupts, but are just spinning and polling the ADC.  So I don’t follow the comment “this RTOS slows down the execution of my code a lot”.

    I think you need to find out how fast your CPU is really running, and if the wait states are set properly.

    Can you describe how you put together your application?  Did you start with some TI example?  What platform did you select for SYS/BIOS?  What board are you running on?  What is the frequency of the input crystal?  The more you can describe the better we’ll be able to help…

    Scott

  • Hello Scott. i'm using a TMS320F28335 DSP. All examples I'm using are configured for a 150MHz clock and I bet the SYSBIOS is also configured for that cause uses the same files to configure the cpu rate. I wasn't using the ADC interrupts so that's why I said that the "SYSBIOS was slowing down my code" cause from the first succesfull poll to the next poll there was a 1ms delay (much more than if I don't use the SYSBIOS) so I guesed the RTOS was doing some operations that made the loop slower. Now i'm using interrupts but without a RTOS and I can achieve sampling frequencies of 1MHz so I think i'm gonna continue on that path....

    Thank you!