# SDFM {#EXAMPLE_MOTORCONTROL_SDFM}
[TOC]
The ICSS %SDFM driver provides a well defined set of APIs to expose sigma delta interface.
The ICSS %SDFM example invokes these APIs to
- Set %SDFM channels
- Set ACC source, NC OSR, OC OSR, Clock source & Clock inversion
- Enable & disable threshold comparators
- Set high, low & zero cross threshold values
- configure sample trigger time (time for read sample)
- Inform firmware to enable %SDFM mode
- Configure GPIO pins for high, low & zero cross thresholds
Once these steps are executed
- ICSS %SDFM example waits for a interrupt (trigger by %SDFM firmware) to read sample data
- when interrupt occurs, example reads sample data from DMEM and again comes back to waiting loop
### ICSS SDFM Example Implementation
Following section describes the Example implementation of ICSS %SDFM on ARM(R5F).
\image html SDFM_EXAMPLE_FLOWCHART.png "ICSS SDFM Example"
## Important files and directory structure
| Test detail
| Steps
| Pass/fail crieteria
|
| To check raw data for 64 NC OSR |
1. Set NC OSR to 64 |
Resolution of sampled data should be 13.9 bits |
|
2. Set data read time half of epwm cycle |
|
|
3. Set epwm output frequency 20Khz |
|
|
4. Draw graph for Raw data |
\image html SDFM_sample_output.PNG "NC sample data" |
| To check raw data for 32 NC OSR |
1. Set NC OSR to 32 |
Resolution of sampled data should be 11.4 bits |
|
2. Set data read time half of epwm cycle |
|
|
3. Set epwm output frequency 20Khz |
|
| To check Threshold comparator |
1. Set High Threshold to 3500 and low threshold to 2500 |
Logic analyzer capture for High & Low Thresholds |
|
2. Set Over current OSR to 32 |
\image html SDFM_threshold_comparator_salea_capture.png "Logic analyzer Capture" |
|
3. Probe Ch0 high, low threshold GPIO pins & input signal |
|
|
4. Capture signal in Logic analyzer |
|