How do I get present current readings via the AMDS? #269
-
Currently, the AMDS sends over previous PWM carrier peak / valley readings when data is requested from it. I would like to modify my code so that my AMDC requests data from the AMDS, waits, and then uses present sampled readings in the calculation. I want to do this because I am running my control task at 25 kHz with a PWM freq of 50 kHz, making the delta T between sampled currents and what my control thinks the currents are sampled at significantly different. Does anyone know how can I modify the AMDS data request code to achieve this? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Thanks for the question, @Bharat-Ramadas. Step 1The first step is to disable the AMDC from automatically asking the AMDS for new data, so that you can do it manually yourself. To do this, update your user config file: ...
// Enable SensorCard platform motherboard auto request new ADC sample data
// set to 1 for enabled, 0 for disabled
#define USER_CONFIG_ENABLE_MOTHERBOARD_AUTO_TX (0)
... Step 2Now, the AMDS will never send over new data until your code asks for it. You can ask for it by calling the driver function: When you call this function, the AMDS will start sending over its latest data, i.e. the data sampled at the last PWM carrier trigger point. Step 3Now, you must wait for the data to arrive. As of now, the only way to tell if the data has arrived is to use the Overall, the easiest way to solve the issue of detecting when new data arrives is: write a new driver function which simply returns the counter values (instead of printing them out). Then, in your control code callback:
Now, you know that new data has arrived. |
Beta Was this translation helpful? Give feedback.
Thanks for the question, @Bharat-Ramadas.
Step 1
The first step is to disable the AMDC from automatically asking the AMDS for new data, so that you can do it manually yourself. To do this, update your user config file:
Step 2
Now, the AMDS will never send over new data until your code asks for it. You can ask for it by calling the driver function:
motherboard_request_new_data(base_addr)
located in the AMDS driver.When you call this function, the AMDS will start sending over its latest data, i.e. the data sampled at…