summaryrefslogtreecommitdiff
path: root/analog
diff options
context:
space:
mode:
authorGuillaume Chevillot2008-03-27 23:15:24 +0100
committerGuillaume Chevillot2008-03-27 23:15:24 +0100
commit4f88ee97a923151dea8f9bf8c1ea3620dc848d08 (patch)
tree320067570b3b8ccd16650a330d415fbb9c81bb48 /analog
parent0e4c3e1829be3a789b29ff174a3e1ab06dc28600 (diff)
Update current limitation to rise an IT on falling edge and no longer
at low level.
Diffstat (limited to 'analog')
-rw-r--r--analog/motor-power-avr/src/TODO.txt15
-rw-r--r--analog/motor-power-avr/src/mp_pwm_LR_.h6
-rw-r--r--analog/motor-power-avr/src/mp_pwm_L_.c8
3 files changed, 11 insertions, 18 deletions
diff --git a/analog/motor-power-avr/src/TODO.txt b/analog/motor-power-avr/src/TODO.txt
index 490817e1..f0654ac8 100644
--- a/analog/motor-power-avr/src/TODO.txt
+++ b/analog/motor-power-avr/src/TODO.txt
@@ -11,21 +11,8 @@ de la limitation en courant
entre les PWM des deux ponts
Tester :
-- la génération de la PWM de la limitation de courant
-- le protocole (commandes 'l', 'r', 'L', 'R', et 'w' testées OK)
+- le protocole (commandes 'l', 'r', 'L', 'R', 'w', 'c' testées OK)
- mesurer la linéarité du PWM
-- tester la limitation en courant. Attention : la carte actuelle ne
-supportera pas plus de 10A. Pour celà, mettre la PWM à une valeur entre 50%
-et 90% sur une charge qui débite environt 3 à 8A (oui... il faut trouver la
-charge, d'autant plus qu'il faut une charge selfique. A mon avis, un gros
-moteur bloqué supportant bien les surcharges ferait l'affaire). Visualiser
-la PWM à l'oscillo (dans l'idéal, visualiser le courant par une pince
-ampèremétrique). Abaisser progressivement la limitation : le rapport
-cyclique doit diminuer, le courant moyen aussi, et le courant pic ne doit
-jamais dépasser la limite fixée par soft.
-- tester l'absence de perturbation d'un pont par l'autre. Pour celà : on
-fixe un pont à une valeur de PWM, et on fait varier la PWM de l'autre pont
-de 0% à PWM_MAX. La PWM du premier pont ne doit jamais varier.
- tester la limitation en température. Faire comme pour le test de
limitation de courant, mais en approchant un fer à souder des capteurs de
température
diff --git a/analog/motor-power-avr/src/mp_pwm_LR_.h b/analog/motor-power-avr/src/mp_pwm_LR_.h
index c9b8b01d..0f35bb86 100644
--- a/analog/motor-power-avr/src/mp_pwm_LR_.h
+++ b/analog/motor-power-avr/src/mp_pwm_LR_.h
@@ -116,9 +116,9 @@
0, 0, 0, 0, 1, 0, 0, 1))
/** Defines external interrupts level configuration :
- * low level of INT0 and INT1 generates an interrup request */
+ * falling edge of INT0 and INT1 generates an interrup request */
#define MCUCR_LR_CFG (regv (SM2, SE, SM1, SM0, ISC11, ISC10, ISC01, ISC00, \
- 0, 0, 0, 0, 0, 0, 0, 0))
+ 0, 0, 0, 0, 1, 0, 1, 0))
/** Enable external interrupts INT1 and INT0 fir current limitation */
#define GICR_LR_CFG (regv (INT1, INT0, INT2, 4, 3, 2, IVSEL, IVCE, \
@@ -133,6 +133,8 @@
#define CURLIM_MAX 0x80
#define OCR_CurLim_L_ OCR1A
#define OCR_CurLim_R_ OCR1B
+#define ILIM_R_io (PIND & (1 << 3))
+#define ILIM_L_io (PIND & (1 << 2))
// Vectors
#define ILIM_R_vect INT1_vect
diff --git a/analog/motor-power-avr/src/mp_pwm_L_.c b/analog/motor-power-avr/src/mp_pwm_L_.c
index d596cf95..1374dced 100644
--- a/analog/motor-power-avr/src/mp_pwm_L_.c
+++ b/analog/motor-power-avr/src/mp_pwm_L_.c
@@ -35,8 +35,12 @@ void init_pwm_L_ (void) {
// PWM rising edge on timer overflow IT
ISR(OVF_L_vect) {
- // programs the state which is ordered by the core code
- state_L_ = state_L_cmd;
+ if(!ILIM_L_io)
+ // stay in High-Z if current limitation still active
+ state_L_ = CMD_STATE_HIGH_Z;
+ else
+ // programs the state which is ordered by the core code
+ state_L_ = state_L_cmd;
switch (state_L_)
{