Makefile addition for GRUVIN9X PCB PORTH real-time diagnostics.
$ make ... PORTH_TIMING=YES See code comments for details. This is used to analyse real-world timing of mixer interrupt, setupPulses and PPM or DSM=SERIAL or DSM2=PPM data output streams. NOTE: Not compatible to SOUND=YES (SOMO14)
This commit is contained in:
+17
-2
@@ -198,6 +198,17 @@ XCURVES = YES
|
|||||||
# Values = YES, NO
|
# Values = YES, NO
|
||||||
GVARS = NO
|
GVARS = NO
|
||||||
|
|
||||||
|
#------- TIMING DEBUG OPTIONS ------------------------
|
||||||
|
|
||||||
|
# Enable debug code to output signals on PORTH for logic analyser timing analysis
|
||||||
|
# G9X V4 board only. **WARNING** Not compatible with TX_CADDY=YES or SOMO14 (VOICE=YES)
|
||||||
|
#
|
||||||
|
# PORTH:7 --> Transistion LOW to HIGH = start of setupPulses(). Transistion HIGH to LOW = end of setupPulses().
|
||||||
|
# PORTH:6 --> LOW->HIGH = start of mixer calcs. HIGH->LOW, end of mixer calcs.
|
||||||
|
#
|
||||||
|
# Values = YES, NO
|
||||||
|
PORTH_TIMING=YES
|
||||||
|
|
||||||
#------- END BUILD OPTIONS ---------------------------
|
#------- END BUILD OPTIONS ---------------------------
|
||||||
|
|
||||||
# Define programs and commands.
|
# Define programs and commands.
|
||||||
@@ -424,8 +435,8 @@ ifeq ($(DEBUG), YES)
|
|||||||
CPPDEFS += -DDEBUG
|
CPPDEFS += -DDEBUG
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(EEPROM_PROGRESS_BAR), YES)
|
ifeq ($(PORTH_TIMING), YES)
|
||||||
CPPDEFS += -DEEPROM_PROGRESS_BAR
|
CPPDEFS += -DPORTH_TIMING
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(SDCARD), YES)
|
ifeq ($(SDCARD), YES)
|
||||||
@@ -528,6 +539,10 @@ ifeq ($(PCB), GRUVIN9X)
|
|||||||
ifeq ($(EXTRA_ROTARY_ENCODERS), YES)
|
ifeq ($(EXTRA_ROTARY_ENCODERS), YES)
|
||||||
CPPDEFS += -DEXTRA_ROTARY_ENCODERS
|
CPPDEFS += -DEXTRA_ROTARY_ENCODERS
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(EEPROM_PROGRESS_BAR), YES)
|
||||||
|
CPPDEFS += -DEEPROM_PROGRESS_BAR
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(PCB), STD128)
|
ifeq ($(PCB), STD128)
|
||||||
|
|||||||
@@ -44,7 +44,15 @@ inline void board_init()
|
|||||||
DDRE = 0b00001010; PORTE = 0b11110100; // 7:PPM_IN, 6: RENC1_B, 5:RENC1_A, 4:USB_DNEG, 3:BUZZER, 2:USB_DPOS, 1:TELEM_TX, 0:TELEM_RX(pull-up off)
|
DDRE = 0b00001010; PORTE = 0b11110100; // 7:PPM_IN, 6: RENC1_B, 5:RENC1_A, 4:USB_DNEG, 3:BUZZER, 2:USB_DPOS, 1:TELEM_TX, 0:TELEM_RX(pull-up off)
|
||||||
DDRF = 0x00; PORTF = 0x00; // 7-4:JTAG, 3:ADC_REF_1.2V input, 2-0:ADC_SPARE_2-0
|
DDRF = 0x00; PORTF = 0x00; // 7-4:JTAG, 3:ADC_REF_1.2V input, 2-0:ADC_SPARE_2-0
|
||||||
DDRG = 0b00010000; PORTG = 0xff; // 7-6:N/A, 5:GearSW, 4: Sim_Ctrl[out], 3:IDL1_Sw, 2:TCut_Sw, 1:RF_Power[in], 0: RudDr_Sw
|
DDRG = 0b00010000; PORTG = 0xff; // 7-6:N/A, 5:GearSW, 4: Sim_Ctrl[out], 3:IDL1_Sw, 2:TCut_Sw, 1:RF_Power[in], 0: RudDr_Sw
|
||||||
DDRH = 0b00110000; PORTH = 0b11011111; // 7:0 Spare port [6:SOMO14D-BUSY 5:SOMO14D-DATA 4:SOMO14D-CLK] [2:VIB_OPTION -- setting to input for now]
|
|
||||||
|
#ifdef PORTH_TIMING
|
||||||
|
DDRH = 0b11110000; PORTH = 0b11011111; // PORTH:7-6 enabled for timing analysis output ... see below ...
|
||||||
|
#else
|
||||||
|
DDRH = 0b10110000; PORTH = 0b11011111; // [7:0 DSM/PPM TX-caddy control. 1=PPM, 0=DSM ]
|
||||||
|
// [6:SOMO14D-BUSY 5:SOMO14D-DATA 4:SOMO14D-CLK] [2:VIB_OPTION -- setting to input for now]
|
||||||
|
// [1:TxD 0:RxD Spare serial port]
|
||||||
|
#endif
|
||||||
|
|
||||||
DDRJ = 0x00; PORTJ = 0xff; // 7-0:Trim switch inputs
|
DDRJ = 0x00; PORTJ = 0xff; // 7-0:Trim switch inputs
|
||||||
DDRK = 0x00; PORTK = 0x00; // anain. No pull-ups!
|
DDRK = 0x00; PORTK = 0x00; // anain. No pull-ups!
|
||||||
#ifdef REV0
|
#ifdef REV0
|
||||||
|
|||||||
@@ -2996,6 +2996,11 @@ uint16_t getTmr16KHz()
|
|||||||
#if defined (PCBGRUVIN9X)
|
#if defined (PCBGRUVIN9X)
|
||||||
ISR(TIMER5_COMPA_vect, ISR_NOBLOCK) // mixer interrupt
|
ISR(TIMER5_COMPA_vect, ISR_NOBLOCK) // mixer interrupt
|
||||||
{
|
{
|
||||||
|
|
||||||
|
#ifdef PORTH_TIMING
|
||||||
|
PORTH |= 0x40; // PORTH:6 LOW->HIGH signals start of mixer interrupt
|
||||||
|
#endif
|
||||||
|
|
||||||
cli();
|
cli();
|
||||||
TIMSK5 &= ~(1<<OCIE5A); //stop reentrance
|
TIMSK5 &= ~(1<<OCIE5A); //stop reentrance
|
||||||
OCR5A = 0x7d * 40; /* 20ms */
|
OCR5A = 0x7d * 40; /* 20ms */
|
||||||
@@ -3027,6 +3032,11 @@ ISR(TIMER5_COMPA_vect, ISR_NOBLOCK) // mixer interrupt
|
|||||||
cli();
|
cli();
|
||||||
TIMSK5 |= (1<<OCIE5A); //stop reentrance
|
TIMSK5 |= (1<<OCIE5A); //stop reentrance
|
||||||
sei();
|
sei();
|
||||||
|
|
||||||
|
#ifdef PORTH_TIMING
|
||||||
|
PORTH &= ~0x40; // PORTH:6 HIGH->LOW signals end of mixer interrupt
|
||||||
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -729,6 +729,11 @@ static void setupPulsesPiccoZ(uint8_t chn)
|
|||||||
void setupPulses()
|
void setupPulses()
|
||||||
{
|
{
|
||||||
uint8_t required_protocol = g_model.protocol;
|
uint8_t required_protocol = g_model.protocol;
|
||||||
|
|
||||||
|
#ifdef PORTH_TIMING
|
||||||
|
PORTH |= 0x80; // PORTH:7 LOW->HIGH signals start of setupPulses()
|
||||||
|
#endif
|
||||||
|
|
||||||
if (s_pulses_paused)
|
if (s_pulses_paused)
|
||||||
required_protocol = PROTO_NONE;
|
required_protocol = PROTO_NONE;
|
||||||
|
|
||||||
@@ -884,6 +889,11 @@ void setupPulses()
|
|||||||
// if PPM16, PPM16 pulses are set up automatically within the interrupts
|
// if PPM16, PPM16 pulses are set up automatically within the interrupts
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef PORTH_TIMING
|
||||||
|
PORTH &= ~0x80; // PORTH:7 HIGH->LOW signals end of setupPulses()
|
||||||
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef SIMU
|
#ifndef SIMU
|
||||||
|
|||||||
Reference in New Issue
Block a user