Skip to content

Commit

Permalink
Merge branch 'master' into eeprom_buffer
Browse files Browse the repository at this point in the history
  • Loading branch information
gwengardner authored Feb 14, 2020
2 parents d811480 + 2c912ae commit 3b06d8e
Show file tree
Hide file tree
Showing 4 changed files with 122 additions and 70 deletions.
33 changes: 24 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
# oauth token for uploads, this decrypts into a variable GITHUB_TOKEN
# which is under pwittich username, using the Travis key
env:
global:
secure: DZCXrTHQDKFHmFqEwyF+kGZ4JBwvkKofhi/kXcaAmokzpUnT2pnqWPMjnV2q9PxEjQ7stonk6U/D0qij74zG+X0Ys+JWKbrIA2jt7M+7WLBZZrzqfGV8PTGPJK6guDPWUmr5419GYKD0f6PwkeymQ582V0Aoa2PSfw1d8sq/fFWaEGoHryFpaOc99ZWsD7CB5jRB663tkcgXkRiH9wvPKrJpJ1n784TfLuQdlqvWIQm4T+UP5dgiubHcun7COtMmZVLQCeJrYZyTQwLQ1/6oKRnwnfsv05wLu8ha3JPZaY4/DqDvTPAwPyiA1maivrI5QZo9af/0Mkn4YmLrp1wsBigbks5ze8a2UIvf5NuHPPs3hRVvSfjNaGp9bCinkh++2PKd1a6HbFIWdt7P+mzyMsbEebs60RFd4/bwc9LOkj2Vm+irxaJgQnS6pToOr2N62mvhX/fMb7Dr7He1jBoQ4aXwSQPUBz3HbVGWlgkmDloG2OXofnmasJjNJYWNDoLa0GD8afjC1TKknP9pDds3r2t061gjt7+XPo4igrSFXInkDZgk2ZiMgSnxLK3YVS2wdx9e0jacrwoz/9gO7na6SBF3+UDKzb4pvJmTol7m8xjJvf+6VUFEyu3MkN61GVGTr4h/ymxkCvSS3va3zDAbUmJOiv9dAB8/ORLHowJ8t8U=

notifications:
email: true

branches:
except:
- dummy
# except: # blacklist
# - dummy
only: # whitelist
- master
- /^v(\d+\.)(\d+)$/

sudo: false

Expand All @@ -27,14 +36,20 @@ addons:
## Set up git user name and tag this commit
# - git config --local user.name pwittich
# - git config --local user.email [email protected]
# would need a tag cmmand here

#deploy:
# provider: releases
# api_key: "GITHUB OAUTH TOKEN"
# file: projects/project2/gcc/cm_mcu.axf
# skip_cleanup: true
# on:
# tags: true
# only on tag
deploy:
provider: releases
api_key: "$GITHUB_TOKEN"
file:
- projects/cm_mcu/gcc/cm_mcu.axf
- projects/cm_mcu/gcc/cm_mcu.bin
- boot_loader/gcc/bl_main.axf
- boot_loader/gcc/bl_main.bin
skip_cleanup: true
on:
tags: true


install:
Expand Down
48 changes: 27 additions & 21 deletions projects/cm_mcu/ADCMonitorTask.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,27 +63,27 @@ struct ADC_Info_t {
// channel sensor.
static
struct ADC_Info_t ADCs[] = {
{12, "VCC_12V", 6.},
{13, "VCC_2V5", 2.},
{14, "VCC_M3V3", 2.},
{16, "VCC_3V3", 2.},
{ 7, "VCC_1V8", 1.},
{15, "VCC_M1V8", 1.},
{ 3, "V_VCCINT", 1.},
{ 8, "K_VCCINT", 1.},
{ 0, "V_MGTY1_AVTT", 1.},
{19, "V_MGTY2_AVTT", 1.},
{11, "K_MGTH_AVTT", 1.},
{ 4, "K_MGTY_AVTT", 1.},
{ 2, "V_MGTY1_VCCAUX", 1.},
{17, "V_MGTY2_VCCAUX", 1.},
{ 6, "K_MGTY_VCCAUX", 1.},
{ 9, "K_MGTH_VCCAUX", 1.},
{ 1, "V_MGTY1_AVCC", 1.},
{18, "V_MGTY2_AVCC", 1.},
{ 5, "K_MGTY_AVCC", 1.},
{10, "K_MGTH_AVCC", 1.},
{ADC_CTL_TS, "TM4C_TEMP", 1.}, // this one is special, temp in C
{ADC_CTL_CH12, "VCC_12V", 6.},
{ADC_CTL_CH13, "VCC_2V5", 2.},
{ADC_CTL_CH14, "VCC_M3V3", 2.},
{ADC_CTL_CH16, "VCC_3V3", 2.},
{ADC_CTL_CH7, "VCC_1V8", 1.},
{ADC_CTL_CH15, "VCC_M1V8", 1.},
{ADC_CTL_CH3, "V_VCCINT", 1.},
{ADC_CTL_CH8, "K_VCCINT", 1.},
{ADC_CTL_CH0, "V_MGTY1_AVTT", 1.},
{ADC_CTL_CH19, "V_MGTY2_AVTT", 1.},
{ADC_CTL_CH11, "K_MGTH_AVTT", 1.},
{ADC_CTL_CH4, "K_MGTY_AVTT", 1.},
{ADC_CTL_CH2, "V_MGTY1_VCCAUX", 1.},
{ADC_CTL_CH17, "V_MGTY2_VCCAUX", 1.},
{ADC_CTL_CH6, "K_MGTY_VCCAUX", 1.},
{ADC_CTL_CH9, "K_MGTH_VCCAUX", 1.},
{ADC_CTL_CH1, "V_MGTY1_AVCC", 1.},
{ADC_CTL_CH18, "V_MGTY2_AVCC", 1.},
{ADC_CTL_CH5, "K_MGTY_AVCC", 1.},
{ADC_CTL_CH10, "K_MGTH_AVCC", 1.},
{ADC_CTL_TS, "TM4C_TEMP", 1.}, // this one is special, temp in C
};

static float fADCvalues[ADC_CHANNEL_COUNT]; // ADC values in volts
Expand Down Expand Up @@ -206,6 +206,8 @@ void ADCMonitorTask(void *parameters)
// handle error here
configASSERT(0);
}
ROM_ADCSequenceDisable(ADC1_BASE, 0);

// ADC0,first sequence
initADC0FirstSequence();
TaskNotifyADC = xTaskGetCurrentTaskHandle();
Expand All @@ -220,6 +222,7 @@ void ADCMonitorTask(void *parameters)
// handle error here
configASSERT(0);
}
ROM_ADCSequenceDisable(ADC0_BASE, 1);


// second sequence for ADC0
Expand All @@ -237,6 +240,8 @@ void ADCMonitorTask(void *parameters)
// handle error here
configASSERT(0);
}
ROM_ADCSequenceDisable(ADC0_BASE, 1);

initADC1SecondSequence();
TaskNotifyADC = xTaskGetCurrentTaskHandle();
ROM_ADCProcessorTrigger(ADC1_BASE, 0);
Expand All @@ -252,6 +257,7 @@ void ADCMonitorTask(void *parameters)
// handle error here
configASSERT(0);
}
ROM_ADCSequenceDisable(ADC1_BASE, 0);

// convert data to float values
for ( int i = 0; i < ADC_CHANNEL_COUNT; ++i ) {
Expand Down
95 changes: 62 additions & 33 deletions projects/cm_mcu/CommandLineTask.c
Original file line number Diff line number Diff line change
Expand Up @@ -708,45 +708,74 @@ static BaseType_t ff_ctl(char *m, size_t s, const char *mm)
// right now.
static BaseType_t fpga_ctl(char *m, size_t s, const char *mm)
{
int copied = 0;
static int whichfpga = 0;
int howmany = fpga_args.n_devices*fpga_args.n_pages;
if ( whichfpga == 0 ) {
TickType_t now = pdTICKS_TO_MS( xTaskGetTickCount())/1000;
TickType_t last = pdTICKS_TO_MS(getFFupdateTick())/1000;
if ( (now-last) > 60 ) {
int mins = (now-last)/60;
copied += snprintf(m+copied, s-copied, "%s: stale data, last update %d minutes ago\r\n", __func__, mins);
int8_t *p1;
BaseType_t p1l;
int argc = 0;
p1 = FreeRTOS_CLIGetParameter(mm, 1, &p1l);
if ( p1 != NULL ) {
++argc;
p1[p1l] = 0x00; // terminate strings
}
if ( argc == 1 ) {
if ( strncmp(p1, "done",4) == 0 ) { // print out value of done pins
int ku_done_ = read_gpio_pin(_K_FPGA_DONE);
int vu_done_ = read_gpio_pin(_V_FPGA_DONE);
//int copied =
snprintf(m, s, "KU_DONE* = %d\r\nVU_DONE* = %d\r\n", ku_done_, vu_done_);
return pdFALSE;
}
else {
snprintf(m, s, "%s: invalid command %s\r\n", __func__, p1);
return pdFALSE;
}

copied += snprintf(m+copied, s-copied, "FPGA monitors\r\n");
copied += snprintf(m+copied, s-copied, "%s\r\n", fpga_args.commands[0].name);
}
else if (argc != 0 ) {
// error, invalid
snprintf(m,s, "%s: invalid argument count %d\r\n", __func__);
return pdFALSE;
}
else {
int copied = 0;
static int whichfpga = 0;
int howmany = fpga_args.n_devices*fpga_args.n_pages;
if ( whichfpga == 0 ) {
TickType_t now = pdTICKS_TO_MS( xTaskGetTickCount())/1000;
TickType_t last = pdTICKS_TO_MS(getFFupdateTick())/1000;
if ( (now-last) > 60 ) {
int mins = (now-last)/60;
copied += snprintf(m+copied, s-copied, "%s: stale data, last update %d minutes ago\r\n", __func__, mins);
}

for ( ; whichfpga < howmany; ++whichfpga ) {
float val = fpga_args.pm_values[whichfpga];
int tens = val;
int frac = ABS((val - tens)*100.0);

copied += snprintf(m+copied, s-copied, "%5s: %02d.%02d",
fpga_args.devices[whichfpga].name, tens, frac);
if ( whichfpga%2 == 1 )
copied += snprintf(m+copied, s-copied, "\r\n");
else
copied += snprintf(m+copied, s-copied, "\t");
if ( (s-copied ) < 20 ) {
++whichfpga;
return pdTRUE;
copied += snprintf(m+copied, s-copied, "FPGA monitors\r\n");
copied += snprintf(m+copied, s-copied, "%s\r\n", fpga_args.commands[0].name);
}

for ( ; whichfpga < howmany; ++whichfpga ) {
float val = fpga_args.pm_values[whichfpga];
int tens = val;
int frac = ABS((val - tens)*100.0);

copied += snprintf(m+copied, s-copied, "%5s: %02d.%02d",
fpga_args.devices[whichfpga].name, tens, frac);
if ( whichfpga%2 == 1 )
copied += snprintf(m+copied, s-copied, "\r\n");
else
copied += snprintf(m+copied, s-copied, "\t");
if ( (s-copied ) < 20 ) {
++whichfpga;
return pdTRUE;
}

}
if ( whichfpga%2 ==1 ) {
m[copied++] = '\r';
m[copied++] = '\n';
m[copied] = '\0';
}
whichfpga = 0;
return pdFALSE;
}
if ( whichfpga%2 ==1 ) {
m[copied++] = '\r';
m[copied++] = '\n';
m[copied] = '\0';
}
whichfpga = 0;
return pdFALSE;
}

// this command takes no arguments since there is only one command
Expand Down Expand Up @@ -1313,7 +1342,7 @@ CLI_Command_Definition_t fpga_command = {
.pcCommand="fpga",
.pcHelpString="fpga\r\n Displays a table showing the state of FPGAs.\r\n",
.pxCommandInterpreter = fpga_ctl,
0
-1
};
static
CLI_Command_Definition_t sensor_summary_command = {
Expand Down
16 changes: 9 additions & 7 deletions projects/cm_mcu/I2CSlaveTask.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,24 +57,26 @@ static uint8_t getSlaveData(uint8_t address)
value = testreg;
break;
case 0x10U: // MCU temperature
value = (uint8_t) getADCvalue(20);
value = getADCvalue(20)+0.5; // always valid
break;
case 0x12U: // FPGA VU temp
value = (uint8_t) fpga_args.pm_values[0];
if ( value == 0 ) value = 0xFFU; // invalid value
break;
case 0x14U: // FPGA KU temp
value = (uint8_t) fpga_args.pm_values[1];
if ( value == 0 ) value = 0xFFU; // invalid value
break;
case 0x16U: // hottest FF temp
{
int8_t imax_temp = -99.0;
int8_t imax_temp = -55; // turn off value
for ( int i = 0; i < NFIREFLIES; ++i ) {
int8_t v = getFFvalue(i);
if ( v > imax_temp )
imax_temp = v;
}
if ( imax_temp == -99 )
value = 0xFF;
if ( imax_temp < 0 )
value = 0xFFU; // invalid
else
value = (uint8_t) imax_temp;
}
Expand All @@ -90,10 +92,10 @@ static uint8_t getSlaveData(uint8_t address)
max_temp = thistemp;
}
}
if ( max_temp == -99 )
value = 0xFFU;
if ( max_temp < 0 )
value = 0xFFU; // invalid
else
value = (uint8_t) max_temp;
value = (uint8_t) max_temp+0.5;
}
break;
default:
Expand Down

0 comments on commit 3b06d8e

Please sign in to comment.