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.

CCS/TMS320F28069: Using TMS320F28069 and AFE031 to develop a data transmission system

Part Number: TMS320F28069
Other Parts Discussed in Thread: AFE031, C2000WARE, CONTROLSUITE

Tool/software: Code Composer Studio

Hi everyone, I'm new in the world of DSP.

I’d like to use TMS320F28069 and AFE031 to develop a data transmission system, and I have read PRIME_DDK_PackageV7910. But when I first program the transmission module, the process is not smooth, here are some problems:

  1. I want to use the API of HAL layer to program the entire transmission system and call the HAL layer API plus some of my own program to achieve PHY layer. Is this feasible? How can I complete this procedure?

  2. I try to initialize with HAL_afeInit(), HAL_afeTxInit() and HAL_afeRxInit(), then use HAL_afeSet() at AFE_TX_START. Is this possible to send a signal?

  3. According to the API document, HAL_afeDacCnv() is used to convert the digital data into DAC format. Do I need this API? Why the output is always 2048?

  4. When using the AFE_TX_START of HAL_afeSet(), how should I configure the struct HAL_afe_txSetParms_t? Such as the CPU timre0 and the pointer to callback function.

  5. I just enable the DAC port between the 28069 and DAC Register. Do I need to configure the other ports? Such as the ports of SPI between 28069 and AFE.

  • Hi Hao,

    I will follow up with you offline.


    Thank you,
    Brett

  • Hi Hao,

    From what you have said it looks like you need a driver for interfacing with with the AFE031. There is an Application Note and example program that may be of use to you. These will instruct and demonstrate how to properly configure the AFE031 in software.

    App Note:

    www.tij.co.jp/.../sprac94.pdf

    The Example program is located in C2000Ware at the following directory:

    C:\ti\c2000\C2000Ware_1_00_02_00\device_support\f2837xd\examples\cpu1\boostxl_afe031_f28379d_dacmode

    Please note that the example program is for F2837xd, but you should be able to port what you need over to your specific device.

    Hope this helps,
    Kevin
  • Hi Kevin,
    Thank you very much for your reply!
    I have read the app note and example program you provided. This program doesn't use any API.
    I think using the API of PRIME in my program can save time. Could someone tell me how to use the API?
    Or if I want to drive AFE03x, I have to start writing the program from controlling the pins?
    Regards.
  • Hi Hao,

    While the example program I mentioned may not use the API you are looking at, it does have functions & macros for interfacing with the AFE031 that you may utilize. Section 3.1 of the App Note explains what these functions & macros do and how to configure the AFE031 for transmission.

    Please take the time to go through this section and all functions/macros of the example program again, as I really think it can help you.

    Best,
    Kevin
  • Hi Kevin,
    Your suggestion is very helpful to me!
    Now I try to port it to my specific device (TMS320F28069).
    However, F2806x_GlobalPrototypes.h doesn't have the GPIO_SetupPinOptions() and GPIO_SetupPinMux() which is originally in F2837xD_GlobalPrototypes.h. I think GPIO_SetupPinMux is for multiplexing settings of pins.
    What's the function of GPIO_SetupPinOptions? How should I configure these in F28069?

    Best regards,
    Hao
  • Hi Hao,

    Great, I hope you are able to get all the guidance you need from the example program and app note.

    You can configure the GPIOs using the GPIO registers mentioned on page 119 of the F2806x TRM:

    The registers that you will want to look at to replicate the example code functions are the following:

    GPAMUX/GPBMUX - For setting the GPIO multiplexer values
    GPADIR/GPBDIR - For setting GPIO as an input or output
    GPAPUD/GPBPUD - For enabling/disabling pullups

    Hope this helps,
    Kevin

  • Hi Kevin,
    Now I have tried to use the example program on F28069. However, there is a kind of error :


    Description Resource Path Location Type
    unresolved symbol _DMACH1AddrConfig, first referenced in ./boostxl_afe031_f28379d_dacmode_main.obj test C/C++ Problem

    I found that DMACH1AddrConfig(volatile Uint16 *DMA_Dest, volatile Uint16 *DMA_Source) was defined in F2806x_GlobalPrototypes.h. Is this because the function is used without the corresponding lib? And I don't know how to find corresponding libs.


    Best regards,
    Hao

  • Hao,

    It probably has something to do with your includes, to where your program doesn't see the content within F2806x_GlobalPrototypes.h.

    Right click your project and click properties ==> expand build ==> expand C2000 compiler ==> Click include options.

    Make sure the following directories are included if using C2000Ware (If using controlSuite find these same directories and add them):

    C:\ti\c2000\C2000Ware_1_00_02_00\device_support\f2806x\common\include
    C:\ti\c2000\C2000Ware_1_00_02_00\device_support\f2806x\headers\include

    Hope this helps,
    Kevin
  • Hi Kevin,

    Thank you for your patient guidance!

    I have already finished the operation before, but the error still exist.

    And I forget to say that I haven't been able to import the project "boostxl_afe031_f28379d_dacmode". So I finish the project by creating a new project and add files from the c2000Ware. I use the CCS v6.10. Is it because that the version is too low? 

    Best regards,

    Hao

  • Hi Hao,

    Your project is most likely still missing a few files or linking incorrectly. If you aren't able to import the original project correctly, and see that it builds correctly, I would suggest trying to fix that first. Then you would be able to compare the original project to your own and see what you may be missing.

    In your screenshot it looks like you're using the TI Resource Explorer to import the project. Do you have the C2000Ware repository physically installed on your hard drive?

    It may work better if you select project at the top of the page ==> select Import CCS Projects... ==> then browse to the project within the C2000Ware directory on your computer and import it.

    The project in your workspace should look like this:

    Hope this helps,

    Kevin

  • Hi Kevin,

    I have installed c2000Ware in the "C:\ti". But it still failed by importing CCS Projects from the C2000Ware directory.

    What's the version of CCS you are using?

    Is the files in boostxl_afe031_f28379d_dacmode of c2000Ware in my computer right?

    The file look like this: 

    And in ccs folder:

    And in targetConfigs folder:

    Best regards,

    Hao

  • Hi Hao,

    The files you have look to be correct. I think updating your CCS version actually could help since using .projectspec files for importing projects is sort of a newer feature. As you can see in your files, this project does use a .projectspec file.

    The current CCS version I am using is 7.2.0 and it works fine.

    Best,
    Kevin
  • Hi Kevin,

    When I was writing the program, I found that 2806x doesn't have something in 2837x.
    Here are some statements in example program of 2833x.

    1. CpuSysRegs.SECMSEL.bit.PF2SEL = 1;
    // Secondary Master Select register for common peripherals: Selects between CLA & DMA
    // Secondary Master Select for VBUS32_2 Bridge

    2. InputXbarRegs.INPUT5SELECT = 500;
    // Setting to a GPIO number above what exists on device, to avoid interference.

    3. SpiaRegs.SPICCR.bit.HS_MODE = 0x1;
    // High Speed mode control

    I can't find the corresponding in 2806x. Will these affect my program?
    And for the first one, could I replace it with "SysCtrlRegs.EPWMCFG.bit.CONFIG = 1"?

    Best,
    Hao
  • Hi Hao,

    1. Setting this F2837x register to 1 allows the DMA to access shared CPU Peripheral frame. For the F2806x I don't believe there is as much peripheral sharing, there appears to be one mux needing to be set which may be the SysCtrlRegs.EPWMCFG.bit.CONFIG = 1 you mentioned.

    2. F2806x does not have X-bar so you shouldn't need to worry about this.

    3. F2806x does not support the high-speed SPI mode feature that F2837x has. Whether this matters or not will depend on the SPI clock speeds your application will require. From the F2806x datasheet the SPI clock in master transmit mode has a 20 MHz maximum.

    Hope this helps,

    Kevin

  • Hi Kevin,

    Thank you very much for your help!

    Here is a figure in the document "Interfacing the C2000 with an AFE03x B-FSK Example" .

    It looks like the data rather than the modulated signal. Where is it measured from?

    I finished my program with reference to example program. And I deleted the three statements I mentioned in last question. 

    If my program is correct, can I detect a signal from the pin "PA_OUT" of AFE031? I tried this but failed. How can I find out where the problem is?

    Best regards,

    Hao

  • Hi Hao,

    Yes "PA_OUT" will be your output assuming your hardware and software setup are correct.  Checking out the AFE031 datasheet might be helpful to you www.ti.com/lit/gpn/afe031.

    The AFE031's pinouts and inner modules:

    TX Dacmode path followed in the related appnote:

    Best,

    Kevin

  • Hi Kevin,

    I wonder if the SPIA has transmitted data to the AFE31. So I tried to measure the signal of "SPISIMOA" of F28069. But I can not get any signal.

    Is it the configuration error or measurement problem?

    Best,
    Hao
  • Hi Hao,

    The SPI pins are different between F2806x and F2837x. Have you made sure your using the right pins and correctly configured the GPIO muxes? Check the f2806x TRM for what pins have SPI-A peripheral pins and proper mux values.

    You should be able to see a signal on both the SPI data and clock lines. Something is most likely not configured correctly.

    Best,
    Kevin
  • Hi Kevin,

    It seems that the configuration of SPI is correct. The problem is that DMA doesn't send any data to SPI.

    I properly configured the DMA and EPWM. And I also tried to use TIMER0 as the PERINTSEL of DMA. So I think the interrupt which triggers a DMA burst works well. But when the program finally steps into the interrupt of DMA itself, DMA doesn't send any data to *DMA_Dest.

    I have no idea where the problem is. Could you give me some advice to solve it?

    Best,

    Hao

  • Hi Hao,

    Assuming you are doing something similar to the example program, make sure you are initially starting the DMA and resetting the DMA when it needs to be:

        start_dma();      // Start DMA channel
        reset_DMASineTables();

    Can you confirm that your program is entering the dma_isr? I believe using software breakpoints and stepping through your code should help you in finding where the problem resides.

    Hope this helps,

    Kevin

  • Hi Kevin,

    Thank you very much for your help!

    I finally find the problem as follows.

    In the program of F28069, the “*DMADest” and “*DMASource” pointing to “DMABuf1” and “DMABuf2” which are used in

    DMACH1AddrConfig(DMADest,DMASource);

    need to be processed in advance:

    #pragma DATA_SECTION(DMABuf1,“DMARAML5”);
    #pragma DATA_SECTION(DMABuf2,“DMARAML6”);

    However, in the example program, "*DMADest” should be set as “&SpiaRegs.SPITXBUF”.

    And there will be a warning like the bottom of the screenshot if 

    #pragma DATA_SECTION(SpiaRegs,“DMARAML6”);

    Another warning like the top of the screenshot will appear at 

    fill_SineTable(pingBuf [0],的sizeof(pingBuf));
    fill_SineTable(pongBuf [0],的sizeof(pongBuf));

    if

    #pragma DATA_SECTION(pingBuf,“DMARAML5”);
    #pragma DATA_SECTION(pongBuf,“DMARAML5”);


    Best,

    Hao

  • Hi Hao,

    All of these warning seem to be related to allocating space in RAM for the related data. This allocation is performed in the linker command files of the project.

    In the 2806x example you are looking at, the 28069_RAM_lnk.cmd allocated the related memory in the following commands:

       DMARAML5	        : > RAML5,      PAGE = 1
       DMARAML6	        : > RAML6,      PAGE = 1
       DMARAML7	        : > RAML7,      PAGE = 1
       DMARAML8	        : > RAML8,      PAGE = 1   

    In the boostxl_afe031 example project, the SINETABLE is allocated in the following command of 2837xD_RAM_afe031_lnk.cmd:

     SINETABLE        : > RAMLS234    PAGE = 0	/* Ram block for SINETABLE data */

    Hope this helps,

    Kevin

  • Hi Kevin,

    I neglected the warning of SINETABLE. And now I solve it with your help.

    But the most important problem at the moment is the conflicts between DMA and SPI.

    In F28069, if I want to use DMA to send data from DMA_Source (ping buffer or pong buffer) to DMA_Dest (SpiaRegs.SPITXBUF), the register of them need to be programmed in DATA_SECTION as follows.

       DMARAML5	        : > RAML5,      PAGE = 1
       DMARAML6	        : > RAML6,      PAGE = 1
       DMARAML7	        : > RAML7,      PAGE = 1
       DMARAML8         : > RAML8,      PAGE = 1

    However, if I change the DATA_SECTION of SpiaRegs from the former to the latter, the SPIA won't work. 

    #pragma DATA_SECTION(SpiaRegs,"SpiaRegsFile");
    #pragma DATA_SECTION(SpiaRegs,"DMARAML5");

    How should I solve this contradiction?

    Best, 

    Hao

  • Hi Hao,

    Have you been able to prove that these #pragma declarations are vital to the program working?

    The boostxl_afe031_f28379d_dacmode example does not require them and commenting out the following defines in the f2806x example you referenced does not seem to cause any build issues:

    // #pragma DATA_SECTION(DMABuf1,"DMARAML5");
    // #pragma DATA_SECTION(DMABuf2,"DMARAML6");

    I feel like the root problem may be something else...

    Best,

    Kevin

  • Hi Kevin,

    Yes,  commenting out the pragma DATA_SECTION won't cause any build issue, but when I debug the program, the data won't be sent to DMADest neither...

    I found some related descriptionin F2806x TRM. Does it mean that I can't use DMA to send data to SPI?

    The screenshots are DMA features of F2806x and F2837x respectively.

    Best,

    Hao

  • Hi Hao,

    Yes, you are correct. The SPI does not have a connection to the DMA on F2806x, while F2837x devices and beyond do have the SPI to DMA connection. I apologize for not realizing this earlier.

    The McBSP peripheral should be an option for you to receive data from the DMA. McBSP does have a SPI mode you could utilize to send the data to the AFE's DAC. This may require some more digging on your end to figure out, but it is a feasible method.

    Hope this helps,

    Kevin

  • Hi Kevin,

    Thank you very much for your help! Recently I finally finished the final exam and continue my programming. 

    I configurated the McBSP according to F2806x TRM as the screenshot.

    And according to the comment, I configurated the XWDLEN1 of McBSP as 12bit.

    But there is no signal on the output of the AFE031. I tried to measure the signal of MDXA(McBSP) and I can get it.

    Is it possible that SPI did not communicate with Mcbsp that I configured?  How much should I configure the MCLKXA(clock frequency of McBSP)?

    What is the SPI parameter of AFE031? I can't find it from the AFE031 datasheet. 

    Best,

    Hao

  • Hi Hao,

    I am not a McBSP or SPI expert. It may be better to create a new post if you have specific questions regarding those peripherals and someone with more knowledge on them could assist you.

    The mcbsp_spi_loopback example program on C2000Ware may also be good to reference. Located at the following directory:

    C:\ti\c2000\C2000Ware_1_00_03_00\device_support\f2807x\examples\cpu1\mcbsp_spi_loopback

    For configuring the AFE031, following the steps in section 3.1 "Configuring the AFE031" of the app note referenced earlier should help you. This along with the example software.

    The module should be configured to 16-bits to communicate with the AFE031. I'm not sure what you are meaning by "SPI parameter of AFE031". Could you elaborate on what you mean.

    Hope this helps,
    Kevin
  • Hi Kevin,

    Merry Christmas!

    You mentioned that it should be configured to 16-bits to communicate with the AFE031. But in the example project it is configured to 10-bits for SPI. I think it should depend on the Character Length Control Bits of SPI on AFE031. I don't know what it is.

    In the description of SPI Bit Rate (Baud) Control Register, SPI Baud Rate = LSPCLK / ( SPIBRR 1 ). I want to know the value of LSPCLK.

    After the SPI of AFE031 receives the data, the data will be sent to the DAC. What is the range of values that DAC can receive? It seems that I can't get the signal at the output of DAC when the data is too big or too small to enter the DAC.

    Best,

    Hao

  • Hi Hao,

    Thank you and Merry Christmas.

    Yes you are correct, the AFE DAC uses 10 bit (Should be bits not bytes) SPI. In the software example I was looking at the HAL_spi_cfg() initialization function which sets 16 bit SPI initially, but the HAL_afe031_dacEnable() function sets it to 10 bit later on.

    You set the LSPCLK and SPIBRR values within their respective registers. The software example sets both of these values to 1, but keep in mind the target device has a higher frequency (F2837x is 200MHz F2806x is 100MHz). The SPI baud rate equation would then be SPI Baud = LSPCLK / 4. See SPIBRR Register in the F2806x Technical Reference Manual for more info.

    The AFE's DAC is a 10-bit DAC, so the range of values it can receive are from 0x000 to 0x3FF.

    The AFE031's datasheet and the F2806x TRM SPI and McBSP sections can answer a lot of questions for you. Once again, I am not a SPI or McBSP expert and if you need more specific advice/help I'd suggest making a new post.

    Hope this helps,

    Kevin

  • Hi Kevin,

    I read the F2806x TRM SPI and McBSP sections and now I tried to use SPI to send data to AFE031 without DMA.

    I want to do this first to verify that the AFE031 can output the waveform I want. However the waveform is as the photo:

    Yellow waveform is the output of AFE031, and blue waveform is the SPISIMO. The data I tried to send is the sinetable without any modulation.

    I think there are some problems with AFE031 output waveform. Its amplitude is small and the amplitude doesn't change. Its shape seems like damped oscillations.

    I don't know where the problem is. I followed the example project to configure the AFE031 then send data to it. The frequency of SPI is 22.5MHz.

    Best,

    Hao

  • Hi Hao,

    You could try lowering the SPI clock frequency. The AFE031 has a maximum clocking frequency of 20 MHz from its datasheet.

    www.ti.com/lit/gpn/afe031

    Best,

    Kevin

  • Hi Kevin,

    I'm so sorry that the photo is wrong because of the measurement has some errors.

    I reduced the frequency of SPI within 20MHz, but I still couldn't get the signal I wanted. There isn't any signal at the output of AFE031.

    I found that when I send data to AFE031 through SPISIMO pin, the AFE031 was continiously sending data to F28069 through SPISOMI pin. Does it work normally?

    I wonder if the control commands to AFE031 are effective. I tried to send data(MSB=1) to AFE031 in order to read register of AFE031. But I don't know the meaning of back data. And I don't know how to read the DAC register.

    Best,

    Hao

  • Hi Hao,

    I'm sorry for taking so long to get back to you.

    I do not have hardware with me to check some things, but I believe you should be seeing data across the SPISIMO once everything is configured and running correctly. The C2000 is supposed to send values to the AFE031's DAC.

    Do you possibly have a logic analyzer to read the SPI data and make some sense of it? Posting on the Precision Amplifiers forum about this might be beneficial to you as well, since the moderators will know the AFE03x better than I do.

    Best,
    Kevin
  • Hi Kevin,

    Thank you very much for your help in C2000!

    I have posted on the Precision Amplifiers forum and got help. Now the transmit module works well.

    I think this post is solved. And then I will program the receive module. If there is any problem, I'd like to ask for your help.

    Thank you again!

    Best,

    Hao

  • Hi Hao,

    That's great! Happy to hear you got it working.

    OK, if you need help related to the receive module feel free to make a new thread and I will most likely be the one to assist you.

    Best,
    Kevin