diff options
| author | Shlomo Hecht <shlomo@twine-s.com> | 2019-02-27 15:29:38 +0200 |
|---|---|---|
| committer | Shlomo Hecht <shlomo@twine-s.com> | 2019-02-27 15:29:38 +0200 |
| commit | dcaadc1886a2f5169821ba568a78990cc6ced4bc (patch) | |
| tree | 1e9e8d906415a2ce8976f454abef8ab02176509e /Software/Embedded_SW/Embedded | |
| parent | 067e34ae548d2125cf92477af4e8afb4e85f63ce (diff) | |
| download | Tango-dcaadc1886a2f5169821ba568a78990cc6ced4bc.tar.gz Tango-dcaadc1886a2f5169821ba568a78990cc6ced4bc.zip | |
program the alarm definitions and the IDS control to the internal flash. motor info did not work well - probably performance problem in thread PID
Diffstat (limited to 'Software/Embedded_SW/Embedded')
5 files changed, 19 insertions, 10 deletions
diff --git a/Software/Embedded_SW/Embedded/Common/Utilities/idle_task.c b/Software/Embedded_SW/Embedded/Common/Utilities/idle_task.c index 6413c83b1..3528884bb 100644 --- a/Software/Embedded_SW/Embedded/Common/Utilities/idle_task.c +++ b/Software/Embedded_SW/Embedded/Common/Utilities/idle_task.c @@ -94,7 +94,7 @@ extern void IDLE_TASK_package_init(void) idle_counter=0; taskParams.instance->name = IdleTaskName; taskParams.priority = SECOND_MIN_PRIORITY; - taskParams.stackSize = 2048; + taskParams.stackSize = 512; IdleTaskHandle = Task_create((Task_FuncPtr)idle_task, &taskParams, &eb); Error_init(&eb); Task_Params_init(&taskParams); diff --git a/Software/Embedded_SW/Embedded/Drivers/flash_ram/FlashProgram.c b/Software/Embedded_SW/Embedded/Drivers/flash_ram/FlashProgram.c index 2fc66bcf3..c2b228ffb 100644 --- a/Software/Embedded_SW/Embedded/Drivers/flash_ram/FlashProgram.c +++ b/Software/Embedded_SW/Embedded/Drivers/flash_ram/FlashProgram.c @@ -31,6 +31,7 @@ uint32_t ReadAppAndProgram(uint32_t ui32FlashStart,uint32_t ui32FileSize,void* b uint32_t ui32DataSize; uint32_t ui32Remaining; uint32_t ui32ProgAddr; + uint32_t ui32BufferAddr; volatile uint32_t ui32Idx; uint32_t ui32FlashEnd; @@ -67,6 +68,7 @@ uint32_t ReadAppAndProgram(uint32_t ui32FlashStart,uint32_t ui32FileSize,void* b // stick updater). // ui32ProgAddr = ui32FlashStart; + ui32BufferAddr = buffer; ui32Remaining = ui32FileSize; while(ui32Remaining) { @@ -74,6 +76,7 @@ uint32_t ReadAppAndProgram(uint32_t ui32FlashStart,uint32_t ui32FileSize,void* b // Compute how much data was read from this sector and adjust the // remaining amount. // + ui32DataSize = ui32Remaining >= 512 ? 512 : ui32Remaining; ui32Remaining -= ui32DataSize; @@ -81,7 +84,7 @@ uint32_t ReadAppAndProgram(uint32_t ui32FlashStart,uint32_t ui32FileSize,void* b // Call the function to program a block of flash. The length of the // block passed to the flash function must be divisible by 4. // - ROM_FlashProgram((uint32_t *)buffer, ui32ProgAddr, + ROM_FlashProgram((uint32_t *)ui32BufferAddr, ui32ProgAddr, (ui32DataSize + 3) & ~3); // @@ -92,6 +95,7 @@ uint32_t ReadAppAndProgram(uint32_t ui32FlashStart,uint32_t ui32FileSize,void* b if(ui32Remaining) { ui32ProgAddr += ui32DataSize; + ui32BufferAddr += ui32DataSize; } } diff --git a/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c b/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c index 6f8013557..d107154d0 100644 --- a/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c +++ b/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c @@ -124,8 +124,8 @@ AlarmStatusItem AlarmState[MAX_SYSTEM_ALARMS]; * or static variable whose declaration follows the pragma directive (only if using it without #define for example: #pragma location = MOTOR_MAP_IN_FLASH) * The variables must be declared either __no_init or const! */ -//FLASH_MAP AlarmHandlingItemStruc FlashAlarmItem[MAX_SYSTEM_ALARMS]; -const AlarmHandlingItemStruc AlarmItem[MAX_SYSTEM_ALARMS]={ +AlarmHandlingItemStruc *AlarmItem; +const AlarmHandlingItemStruc HardCodedAlarmItem[MAX_SYSTEM_ALARMS]={ {eHundredMillisecond,LimitSwitchAlarm,LimitSwitchAlarmEmpty_1,0,false,true,DEBUG_LOG_CATEGORY__Error,0xFF,0,EVENT_TYPE__DISPENSER_1_EMPTY,"Dispenser 1 Empty"}, {eHundredMillisecond,LimitSwitchAlarm,LimitSwitchAlarmEmpty_2,1,false,true,DEBUG_LOG_CATEGORY__Error,0xFF,0,EVENT_TYPE__DISPENSER_2_EMPTY,"Dispenser 2 Empty"}, {eHundredMillisecond,LimitSwitchAlarm,LimitSwitchAlarmEmpty_3,2,false,true,DEBUG_LOG_CATEGORY__Error,0xFF,0,EVENT_TYPE__DISPENSER_3_EMPTY,"Dispenser 3 Empty"}, @@ -329,7 +329,10 @@ void AlarmHandlingInit(void) AlarmState[Alarm_i].DebounceCounter = 0; AlarmState[Alarm_i].EventPtr = NULL; } -// ReadAppAndProgram(ALARM_MAP_IN_FLASH, sizeof(AlarmHandlingItemStruc)*MAX_SYSTEM_ALARMS, AlarmItem); + + AlarmItem = (AlarmHandlingItemStruc *)MOTOR_MAP_IN_FLASH; + ReadAppAndProgram(AlarmItem, sizeof(AlarmHandlingItemStruc)*MAX_SYSTEM_ALARMS, HardCodedAlarmItem); + LOG_ERROR(AlarmItem[2].EventName,"Flash Test"); return; } diff --git a/Software/Embedded_SW/Embedded/Modules/General/process.c b/Software/Embedded_SW/Embedded/Modules/General/process.c index 73402d1f4..dd9f8deae 100644 --- a/Software/Embedded_SW/Embedded/Modules/General/process.c +++ b/Software/Embedded_SW/Embedded/Modules/General/process.c @@ -237,7 +237,7 @@ uint32_t ProcessParamsInit(void) //memcpy (&ProcessParametersKeep,ProcessParams,sizeof(ProcessParameters)); upload_process_parameters_request__free_unpacked(request,NULL); } - free (buffer); + free (buffer); } } f_close(FileHandle); diff --git a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c index e8d0f2673..ed91f194a 100644 --- a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c +++ b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c @@ -17,6 +17,7 @@ #include "modules/heaters/heaters.h" +#include "drivers/Flash_ram/FlashProgram.h" typedef struct { @@ -29,7 +30,7 @@ typedef struct bool m_isReady; PID_Config_Params m_params; }DispenserControlConfig_t; -HardwarePidControl DispensersControl[MAX_SYSTEM_DISPENSERS] = {0}; +HardwarePidControl *DispensersControl = (HardwarePidControl *)GENHWCFG_MAP_IN_FLASH + 0x4000;; int32_t DispenserSamples[MAX_SYSTEM_DISPENSERS][MAX_CONTROL_SAMPLES] = {0}; int DispenserSamplePointer[MAX_SYSTEM_DISPENSERS] = {0}; @@ -66,9 +67,10 @@ uint32_t IDS_DispenserPidRequestMessage(HardwarePidControl* request) break; } } - memcpy (&DispensersControl[Dispenser_i],request,sizeof(HardwarePidControl)); - if (DispensersControl[Dispenser_i].pvinputfilterfactormode > MAX_CONTROL_SAMPLES) - DispensersControl[Dispenser_i].pvinputfilterfactormode = MAX_CONTROL_SAMPLES; + if (request->pvinputfilterfactormode > MAX_CONTROL_SAMPLES) + request->pvinputfilterfactormode = MAX_CONTROL_SAMPLES; + ReadAppAndProgram(&DispensersControl[Dispenser_i], sizeof(HardwarePidControl), request); + for (i = 0;i < DispensersControl[Dispenser_i].pvinputfilterfactormode; i++) DispenserSamples[Dispenser_i][i] = 0; //reset the samples value for control beginning /*DispenserNormalizedErrorCoEfficient[Dispenser_i] = (2*PI*DancersCfg[ThreadDispenserIdToDancerId[Dispenser_i]].armlength); |
