Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
DIOT Monitoring Module
Manage
Activity
Members
Labels
Plan
Issues
6
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Projects
DIOT Monitoring Module
Commits
ae44969f
Commit
ae44969f
authored
4 years ago
by
Christos Gentsos
Browse files
Options
Downloads
Patches
Plain Diff
PWM: adjustments for the new fan driver's complementary PWM ctrl
parent
c9739288
Branches
Branches containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
main_fw/src/main.c
+11
-13
11 additions, 13 deletions
main_fw/src/main.c
with
11 additions
and
13 deletions
main_fw/src/main.c
+
11
−
13
View file @
ae44969f
...
...
@@ -25,15 +25,13 @@ uint16_t currs_lin[3];
uint16_t
powrs_lin
[
3
];
uint16_t
frpms_lin
[
3
];
const
uint16_t
total_pwm_clocks_1
=
320
;
const
uint16_t
total_pwm_clocks_2
=
320
;
const
uint16_t
total_pwm_clocks_3
=
320
;
#define TOTAL_PWM_CLOCKS 255
uint16_t
curr_pwm_duty1000_1
__xMR
=
10
;
uint16_t
curr_pwm_duty1000_2
__xMR
=
10
;
uint16_t
curr_pwm_duty1000_3
__xMR
=
10
;
#define FAN_RAMPUP
3
00
#define FAN_RAMPUP
8
00
uint16_t
goal_pwm_duty1000_1
__xMR
=
FAN_RAMPUP
;
uint16_t
goal_pwm_duty1000_2
__xMR
=
FAN_RAMPUP
;
...
...
@@ -47,8 +45,8 @@ uint16_t tacho_rpm[3];
// when fan_cmdrpm is 0, setfrpms and temp_curve_points_y represent
// duty cycle (0 to 1000)
uint16_t
fan_installed
[
3
]
__xMR
=
{
1
,
1
,
1
};
uint16_t
fan_cmdrpm
[
3
]
__xMR
=
{
1
,
1
,
0
};
uint16_t
fan_installed
[
3
]
__xMR
=
{
1
,
1
,
0
};
uint16_t
fan_cmdrpm
[
3
]
__xMR
=
{
0
,
0
,
0
};
uint16_t
fan_ppr
[
3
]
__xMR
=
{
1
,
1
,
1
};
// a 1 here means 2 pulses per revolution
uint16_t
setfrpms
[
3
]
__xMR
=
{
1000
,
100
,
100
};
...
...
@@ -73,12 +71,12 @@ float currs[3];
#define ADC_MAX 65535.0
// V[V] = V_adc * scaling_coeff
const
float
volt_scaling_coeff
[
3
]
=
{
1
/
(
10
.
0
/
(
90
.
9
+
10
.
0
)),
1
/
(
10
.
0
/
(
20
.
0
+
10
.
0
)
),
1
/
(
10
.
0
/
(
10
.
0
+
10
.
0
)
)
};
const
float
curr_scaling_coeff
[
3
]
=
{
1
/
(
10
.
0
/
(
10
.
0
+
10
.
0
)),
1
/
(
1
0
.
0
/
(
1
0
.
0
+
10
.
0
)
),
1
/
(
1
0
.
0
/
(
1
0
.
0
+
10
.
0
)
)};
const
float
volt_scaling_coeff
[
3
]
=
{(
10
.
0
+
2
.
0
)
/
2
.
0
,
(
18
.
0
+
10
.
0
)
/
10
.
0
,
(
10
.
0
+
10
.
0
)
/
10
.
0
};
const
float
curr_scaling_coeff
[
3
]
=
{
1
/
(
10
.
0
/
(
10
.
0
+
10
.
0
)),
(
1
.
0
/
10
)
*
(
1
.
0
/
10
),
(
1
.
0
/
10
)
*
(
1
.
0
/
10
)};
// T[degC] = (V_adc + a) * b
const
float
temp_coeff_a
[
3
]
=
{
-
0
.
6
,
-
0
.
6
,
-
0
.
6
};
const
float
temp_coeff_b
[
3
]
=
{
100
.
0
,
100
.
0
,
100
.
0
};
const
float
temp_coeff_a
[
3
]
=
{
0
,
-
1e-3
*
100
.
0
*
19
.
0
,
-
1e-3
*
100
.
0
*
19
.
0
};
const
float
temp_coeff_b
[
3
]
=
{
100
.
0
,
100
.
0
/
(
1e-3
*
19
.
0
*
(
138
.
5
-
100
.
0
)),
100
.
0
/
(
1e-3
*
19
.
0
*
(
138
.
5
-
100
.
0
))
};
uint16_t
trig_adc_next_second
__xMR
=
0
;
...
...
@@ -163,9 +161,9 @@ void __xMR update_pwm()
curr_pwm_duty1000_3
=
0
;
}
pwm_set_parameters
(
&
PWM_0
,
total_pwm_clocks_1
,
total_pwm_clocks_1
*
(
float
)(
curr_pwm_duty1000_1
/
1000
.
0
));
pwm_set_parameters
(
&
PWM_1
,
total_pwm_clocks_2
,
total_pwm_clocks_2
*
(
float
)(
curr_pwm_duty1000_2
/
1000
.
0
));
pwm_set_parameters
(
&
PWM_2
,
total_pwm_clocks_3
,
total_pwm_clocks_3
*
(
float
)(
curr_pwm_duty1000_3
/
1000
.
0
));
pwm_set_parameters
(
&
PWM_0
,
TOTAL_PWM_CLOCKS
,
TOTAL_PWM_CLOCKS
*
(
float
)(
curr_pwm_duty1000_1
/
1000
.
0
));
pwm_set_parameters
(
&
PWM_1
,
TOTAL_PWM_CLOCKS
,
TOTAL_PWM_CLOCKS
*
(
float
)(
curr_pwm_duty1000_2
/
1000
.
0
));
pwm_set_parameters
(
&
PWM_2
,
TOTAL_PWM_CLOCKS
,
TOTAL_PWM_CLOCKS
*
(
float
)(
curr_pwm_duty1000_3
/
1000
.
0
));
}
void
__xMR
adc_cb
(
const
struct
adc_async_descriptor
*
const
descr
,
const
uint8_t
channel
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment