diff --git a/sdk/.vscode/settings.json b/sdk/.vscode/settings.json
new file mode 100644
index 00000000..0cba2e68
--- /dev/null
+++ b/sdk/.vscode/settings.json
@@ -0,0 +1,5 @@
+{
+ "files.associations": {
+ "iostream": "cpp"
+ }
+}
\ No newline at end of file
diff --git a/sdk/FreeRTOS-Plus-TCP b/sdk/FreeRTOS-Plus-TCP
index 978354ea..c81b3632 160000
--- a/sdk/FreeRTOS-Plus-TCP
+++ b/sdk/FreeRTOS-Plus-TCP
@@ -1 +1 @@
-Subproject commit 978354eadb450ffc34ed21a2a8bcba33a1c2b018
+Subproject commit c81b3632cf2e26eccb729a699ea7683226d3f1be
diff --git a/sdk/freertos_app_cpu0/.cproject b/sdk/freertos_app_cpu0/.cproject
index 9662aac0..a7d26b88 100644
--- a/sdk/freertos_app_cpu0/.cproject
+++ b/sdk/freertos_app_cpu0/.cproject
@@ -28,7 +28,7 @@
-
+
-
+
@@ -76,7 +76,7 @@
-
+
@@ -94,7 +94,7 @@
-
+
@@ -132,7 +132,7 @@
-
+
-
+
@@ -180,7 +180,7 @@
-
+
@@ -196,7 +196,7 @@
-
+
diff --git a/sdk/freertos_app_cpu0/src/main.c b/sdk/freertos_app_cpu0/src/main.c
index 11a7f944..beb28fc9 100644
--- a/sdk/freertos_app_cpu0/src/main.c
+++ b/sdk/freertos_app_cpu0/src/main.c
@@ -234,7 +234,7 @@ void vApplicationGetTimerTaskMemory(StaticTask_t **ppxTimerTaskTCBBuffer, StackT
}
void vApplicationStackOverflowHook(TaskHandle_t xTask, char * pcTaskName) {
- xil_printf("STACK OVERRFLOW ON TASK %s\n", pcTaskName);
+ xil_printf("STACK OVERFLOW ON TASK %s\n", pcTaskName);
}
/*******************************************************************************/
diff --git a/sdk/freertos_app_cpu0/src/usr/vsiApp/app_vsiApp.c b/sdk/freertos_app_cpu0/src/usr/vsiApp/app_vsiApp.c
index 4ceedda3..952dff3f 100644
--- a/sdk/freertos_app_cpu0/src/usr/vsiApp/app_vsiApp.c
+++ b/sdk/freertos_app_cpu0/src/usr/vsiApp/app_vsiApp.c
@@ -18,6 +18,8 @@ void app_vsiApp_init(void)
timing_manager_enable_sensor(AMDS_2);
// Enable ADC (timing manager)
timing_manager_enable_sensor(ADC);
+ // Enable Encoder (timing manager)
+ timing_manager_enable_sensor(ENCODER);
// Register "vsi" command with system
cmd_vsiApp_register();
}
diff --git a/sdk/freertos_app_cpu0/src/usr/vsiApp/task_vsiApp.c b/sdk/freertos_app_cpu0/src/usr/vsiApp/task_vsiApp.c
index 6ef23628..6e175007 100644
--- a/sdk/freertos_app_cpu0/src/usr/vsiApp/task_vsiApp.c
+++ b/sdk/freertos_app_cpu0/src/usr/vsiApp/task_vsiApp.c
@@ -11,6 +11,7 @@
#include "drv/pwm.h"
#include "drv/analog.h"
#include "drv/amds.h"
+#include "drv/encoder.h"
#include "sys/defines.h"
#include "sys/log.h"
#include "sys/injection.h"
@@ -43,6 +44,9 @@ int task_vsiApp_init(void)
if (pwm_enable() != SUCCESS) {
return FAILURE;
}
+
+ /* Encoder bits */
+ encoder_set_pulses_per_rev_bits(13);
/* Initialize signal injection points */
injection_ctx_init(&inj_ctx_ctrl[0], "amp*");
injection_ctx_init(&inj_ctx_ctrl[1], "theta*");
@@ -57,6 +61,7 @@ int task_vsiApp_init(void)
taskExists = 1;
xTaskCreate(task_vsiApp, (const char *) "vsiApp", configMINIMAL_STACK_SIZE,
NULL, tskIDLE_PRIORITY, &tcb);
+
return SUCCESS;
}
@@ -138,20 +143,25 @@ void task_vsiApp(void *arg)
if (valid == 0xFF) {
// Yay! 0xFF means the bits for all channels are valid!
// Read in values sampled on the AMDS (plugged into your GPIO port) from all channels:
- int err;
- err = amds_get_data(amds_port, AMDS_CH_1, &out_ch_1);
+ amds_get_data(amds_port, AMDS_CH_1, &out_ch_1);
amds_current_a = 0.00125 * out_ch_1;
// Now, "out" variables contain the sign-extended 16-bit
// sample value for each channel
}
- log_callback(&Do, LOG_DOUBLE, "current_a");
+ log_callback(¤t_a, LOG_FLOAT, "current_a");
log_callback(¤t_b, LOG_FLOAT, "current_b");
log_callback(¤t_c, LOG_FLOAT, "current_c");
log_callback(&voltage_a, LOG_FLOAT, "voltage_a");
log_callback(&voltage_b, LOG_FLOAT, "voltage_b");
log_callback(&voltage_c, LOG_FLOAT, "voltage_c");
log_callback(&amds_current_a, LOG_FLOAT, "amds_current_a");
+ log_callback(&Do, LOG_DOUBLE, "amplitude_internal");
+
+ uint32_t encPosition = 0;
+ encoder_get_position(&encPosition);
+ log_callback(&encPosition, LOG_INT, "encoder_position");
+ // xil_printf("encoder value: %d\n", encPosition);
/* delay(50us) */
// uint32_t startDelay = cpu_timer_now();
diff --git a/sdk/shared/sys/log.c b/sdk/shared/sys/log.c
index 4bc9aa42..df40b660 100644
--- a/sdk/shared/sys/log.c
+++ b/sdk/shared/sys/log.c
@@ -820,7 +820,7 @@ int log_print_info(void)
// Initialize the state machine callback tcb
task_info_exists = 1;
- xTaskCreate(state_machine_info_callback, (const char *) "loginfo", configMINIMAL_STACK_SIZE,
+ xTaskCreate(state_machine_info_callback, (const char *) "loginfo", 512,
&ctx_info, tskIDLE_PRIORITY, &ctx_info.tcb);
return SUCCESS;
}