This commit is contained in:
Mats van Reenen 2021-01-27 15:54:05 +01:00
parent c5fd01c8f2
commit 24e3b1e44a
7 changed files with 54 additions and 43 deletions

View File

@ -38,7 +38,6 @@ GPIO2.$name = "CONFIG_GPIO_INIT";
GPIO2.pull = "Pull Down"; GPIO2.pull = "Pull Down";
GPIO2.callbackFunction = "initISR"; GPIO2.callbackFunction = "initISR";
GPIO2.interruptTrigger = "Rising Edge"; GPIO2.interruptTrigger = "Rising Edge";
GPIO2.gpioPin.$assign = "boosterpack.7";
GPIO3.$name = "CONFIG_GPIO_START"; GPIO3.$name = "CONFIG_GPIO_START";
GPIO3.callbackFunction = "startSysISR"; GPIO3.callbackFunction = "startSysISR";
@ -52,6 +51,7 @@ GPIO4.initialOutputState = "High";
GPIO5.$name = "CONFIG_GPIO_CSADC"; GPIO5.$name = "CONFIG_GPIO_CSADC";
GPIO5.mode = "Output"; GPIO5.mode = "Output";
GPIO5.initialOutputState = "High"; GPIO5.initialOutputState = "High";
GPIO5.gpioPin.$assign = "boosterpack.8";
PWM1.$name = "CONFIG_PWM_0"; PWM1.$name = "CONFIG_PWM_0";
PWM1.$hardware = system.deviceData.board.components.LED_RED; PWM1.$hardware = system.deviceData.board.components.LED_RED;
@ -59,7 +59,11 @@ PWM1.$hardware = system.deviceData.board.components.LED_RED;
Power.ioRetentionShutdown = ["GRP_1"]; Power.ioRetentionShutdown = ["GRP_1"];
Power.parkPins.$name = "ti_drivers_power_PowerCC32XXPins0"; Power.parkPins.$name = "ti_drivers_power_PowerCC32XXPins0";
SPI1.$name = "CONFIG_SPI_MASTER"; SPI1.$name = "CONFIG_SPI_MASTER";
SPI1.spi.$assign = "SPI0";
SPI1.spi.sclkPin.$assign = "boosterpack.7";
SPI1.spi.misoPin.$assign = "boosterpack.28";
SPI1.spi.mosiPin.$assign = "boosterpack.15";
Watchdog1.$name = "CONFIG_WATCHDOG_0"; Watchdog1.$name = "CONFIG_WATCHDOG_0";
Watchdog1.watchdog.$assign = "WATCHDOG0"; Watchdog1.watchdog.$assign = "WATCHDOG0";
@ -69,14 +73,10 @@ Watchdog1.watchdog.$assign = "WATCHDOG0";
* version of the tool will not impact the pinmux you originally saw. These lines can be completely deleted in order to * version of the tool will not impact the pinmux you originally saw. These lines can be completely deleted in order to
* re-solve from scratch. * re-solve from scratch.
*/ */
GPIO1.gpioPin.$suggestSolution = "boosterpack.18"; GPIO1.gpioPin.$suggestSolution = "boosterpack.14";
GPIO2.gpioPin.$suggestSolution = "boosterpack.18";
GPIO4.gpioPin.$suggestSolution = "boosterpack.19"; GPIO4.gpioPin.$suggestSolution = "boosterpack.19";
GPIO5.gpioPin.$suggestSolution = "boosterpack.13";
PWM1.timer.$suggestSolution = "Timer2"; PWM1.timer.$suggestSolution = "Timer2";
PWM1.timer.pwmPin.$suggestSolution = "boosterpack.29"; PWM1.timer.pwmPin.$suggestSolution = "boosterpack.29";
SPI1.spi.$suggestSolution = "SPI0";
SPI1.spi.sclkPin.$suggestSolution = "boosterpack.17";
SPI1.spi.misoPin.$suggestSolution = "boosterpack.14";
SPI1.spi.mosiPin.$suggestSolution = "boosterpack.15";
SPI1.spi.dmaRxChannel.$suggestSolution = "UDMA_CH30"; SPI1.spi.dmaRxChannel.$suggestSolution = "UDMA_CH30";
SPI1.spi.dmaTxChannel.$suggestSolution = "UDMA_CH31"; SPI1.spi.dmaTxChannel.$suggestSolution = "UDMA_CH31";

View File

@ -4,7 +4,7 @@
| lable | pin | | lable | pin |
|------------|----:| |------------|----:|
| start init | P05 | | start init | ? |
| start sys | P03 | | start sys | P03 |
| noodstop | P08 | | noodstop | P08 |
@ -12,11 +12,11 @@
| lable | pin | | lable | pin |
|--------|----:| |--------|----:|
| CSK | P45 | | CSK | P05 |
| MISO | P06 | | MISO | P53 |
| MOSI | P07 | | MOSI | P07 |
| CS MSP | P18 | | CS MSP | P18 |
| CS ADC | P21 | | CS ADC | P62 |
## Other ## Other

View File

@ -10,14 +10,16 @@
- [x] ADC aanluiten - [x] ADC aanluiten
- [ ] testcode voor mppt maken - [x] testcode voor mppt maken
- [ ] testcode voor spi maken - [x] testcode voor spi maken
- [ ] testcode voor i2c maken - [ ] testcode voor i2c maken
- [ ] uart deel maken - [ ] uart deel maken
## maandag ## maandag
- [ ] mppt testen - [ ] mppt testen
een mosfet driver is in bestelling
- [ ] adc testen - [ ] adc testen
- [ ] mppt updaten - [ ] mppt updaten
@ -25,8 +27,8 @@
## dinsdag ## dinsdag
- [ ] adc testen - [x] adc testen
- [ ] spi testen - [x] spi testen
## woensdag ## woensdag

View File

@ -4,6 +4,7 @@
#include "debug.h" #include "debug.h"
#include "global.h" #include "global.h"
#include "MPPT.h" #include "MPPT.h"
#include "noodstop.h"
#include "spi.h" #include "spi.h"
#define PWM_MIN 0.001 #define PWM_MIN 0.001
@ -30,11 +31,10 @@ void mppt_meetVermogen(){
uint16_t curent = ADC_read(ADC_CH3); uint16_t curent = ADC_read(ADC_CH3);
//TODO: add real formula for spanning and curent //TODO: add real formula for spanning and curent
mppt_vermogen = (spanning * curent) / 100; mppt_vermogen = (spanning * curent) / 100;
noodstop_vermogen(mppt_vermogen);
} }
void mppt_init(){ void mppt_init(){
PWM_init();
PWM_Params params; PWM_Params params;
PWM_Params_init(&params); PWM_Params_init(&params);
params.dutyUnits = PWM_DUTY_FRACTION; params.dutyUnits = PWM_DUTY_FRACTION;

View File

@ -99,9 +99,9 @@ void * mainTask(void *arg){
break; break;
case OVERHEAD: case OVERHEAD:
case OVERLOAD: case OVERLOAD:
case OVERSPEED:
case EXT_NOODSTOP: case EXT_NOODSTOP:
stopSys(); stopSys();
case OVERSPEED: // don't stop on overload first wait for speed to go down
return; return;
} }
lastState = Status; lastState = Status;

View File

@ -35,14 +35,25 @@ void noodstop_snelhied(uint16_t snelhied){
// controleer snelheid // controleer snelheid
if(snelhied > nood_maxwaardes.maxSnelheid){ if(snelhied > nood_maxwaardes.maxSnelheid){
// PANIC!! // PANIC!!
mppt_setSetpointOverride(nood_maxwaardes.maxVermogen); mppt_setSetpointOverride(nood_maxwaardes.maxVermogen); // zet vemogen max om de de snelheid te beperken
noodstop_activeerNoodstop(); // geef noodstop aan andere units
Status = OVERSPEED;
// Wacht 0.5 seconde // Wacht 0.5 seconde
usleep(500E3); usleep(500E3);
// activeer noostop // zet het systeem uit
Status = OVERSPEED; mppt_setSetpointOverride(0);
noodstop_activeerNoodstop(); }
}
void noodstop_vermogen(uint8_t vermogen){
// controleer vermogen
if(snelhied > nood_maxwaardes.maxVermogen){
// PANIC!!
mppt_setSetpointOverride(0); // zet vemogen max om de de snelheid te beperken
noodstop_activeerNoodstop(); // geef noodstop aan andere units
Status = OVERLOAD;
} }
} }
@ -101,14 +112,11 @@ void noodstop_init(){
memset(&nood_maxwaardes, 0xff, sizeof(nood_maxwaardes)); // set all max value to invalid ones memset(&nood_maxwaardes, 0xff, sizeof(nood_maxwaardes)); // set all max value to invalid ones
// controleer max waardes // controleer max waardes
while(1){ while(
if( nood_maxwaardes.maxSnelheid > 60000
nood_maxwaardes.maxSnelheid <= 60000 || nood_maxwaardes.maxTempratuur < 60 || nood_maxwaardes.maxTempratuur > 120
&& nood_maxwaardes.maxTempratuur >= 60 && nood_maxwaardes.maxTempratuur <= 120 || nood_maxwaardes.maxVermogen > 250)
&& nood_maxwaardes.maxVermogen <= 250 {
){
break; // stop the loop, values are valid
}
usleep(100E3); usleep(100E3);
} }

View File

@ -3,15 +3,16 @@
#include <stdint.h> #include <stdint.h>
void noodstop_setMaxVermogen(uint8_t value); void noodstop_setMaxVermogen(uint8_t value); // set max vermogen
void noodstop_setMaxSnelheid(uint16_t value); void noodstop_setMaxSnelheid(uint16_t value); // set max snelheid
void noodstop_setMaxTemptratuur(uint8_t value); void noodstop_setMaxTemptratuur(uint8_t value); // set max tempratuur
void noodstop_snelhied(uint16_t snelhied); void noodstop_snelhied(uint16_t snelhied); // geef snelhied door
void noodstop_vermogen(uint8_t vermogen); // geef vermogen door
void noodstop_init();
void noodstop_start(); void noodstop_init(); // initaliseer noodstop
void noodstop_start(); // start de noodstop logica
uint8_t noodstop_getTempratuur();
void noodstop_activeerNoodstop(); uint8_t noodstop_getTempratuur(); // verkrijg temptartuur
void noodstop_activeerNoodstop(); // zet de noodstop pin laag
#endif #endif