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.

TMS320F280049C: F280049 SDFM program

Part Number: TMS320F280049C
Other Parts Discussed in Thread: AMC1306EVM, C2000WARE

Hi

I try to use AMC1306EVM to test  SDFM program. I made some changes on file sdfm_ex4_pwm_sync_cpuread.c

under folder //ti/c2000/C2000Ware_3_02_00_00/drivelib/f28004x/examples/sdfm.

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
//###########################################################################
//
// FILE: sdfm_ex4_pwm_sync_cpuread.c
//
// TITLE: SDFM PWM Sync Example
//
//! \addtogroup driver_example_list
//! <h1> SDFM PWM Sync </h1>
//!
//! In this example, SDFM filter data is read by CPU in SDFM ISR routine. The
//! SDFM configuration is shown below:
//! - SDFM1 is used in this example.
//! - MODE0 Input control mode selected
//! - Comparator settings
//! - Sinc3 filter selected
//! - OSR = 32
//! - hlt = 0x7FFF (Higher threshold setting)
//! - llt = 0x0000(Lower threshold setting)
//! - Data filter settings
//! - All the 4 filter modules enabled
//! - Sinc3 filter selected
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

The main changes are as follows (Marks "JAIKAI" in the code):

1. Change Sdfm1.CH1 GPIO to GPIO16 and GPIO17.

2. Change PWM1 to generate a 2MHz 50/50 duty cycle (PWM1A offers clock for both Sdfm1.CH1 and AMC1306EVM).

I run the code but the program never enters interrupt routine sdfmDR1ISR and sdfm1ErrorISR.

if PWM1 doesn't connect to GPIO17, the program enters sdfmErrorISR but still doesn't enter sdfmDR1ISR.

thanks,

Jiakai

  • Hi Jaikai,

    The PWM period that you've set is less than the counter compare value in the register because of which the device is not getting clocked properly. Request you to check the EPWM output once that you're using to clock the SDFM module.

    Also, I will suggest not to call functions again if the value is not getting changed, eg. setting prescalar is called twice is your code.

    Thanks,

    Aditya

  • Hi Aditya,

    I check the code again, I found that the CPU doesn't break on the break point in interrupt routine sdfmDR1ISR,

    the program enters a loop below and cannot get out of the loop.

        while((HWREG(SDFM1_BASE + SDFM_O_SDIFLG) & 0xF000U) != 0xF000U)
       {
       }

    I have changed the program as below and now the code works:

    while((HWREG(SDFM1_BASE + SDFM_O_SDIFLG) & 0xF000U) != 0x1000U)

    Could you teach me how to add FIFO operation in this code?

    thanks,

    Jiakai

  • Hi Jaikai,

    Glad that you found the issue. Although, can you clarify whether you updated the PWM configurations? I would love to know.

    For enabling FIFO, you may refer to <sdfm_ex5_filter_sync_fifo_cpuread>. A section of code is directly available which you can utilize in your code.

    Aditya

  • Hi Aditya,

    I changed PWM configuration because I need PWM1 to provide clock for both AMC1306EVM and SDFM1.C1.

    I have merged ex4 and ex5 so the program now can use PWM8.SOCA to start SDFM data conversion, after pushing

    enough data into FIFO, SDFM causes an interrupt.

    Thank you very much for your help.

    Jiakai