diff --git a/.hgignore b/.hgignore --- a/.hgignore +++ b/.hgignore @@ -10,6 +10,7 @@ tests/*.err doc *.srec FSW-qt/bin/fsw +timegen-qt/bin/timegen src/LFR_basic-parameters *.pro.user.* FSW-qt/bin/spectralmatrix/asm_f0_test_20140403_case1.txt diff --git a/.hgsubstate b/.hgsubstate --- a/.hgsubstate +++ b/.hgsubstate @@ -1,2 +1,2 @@ a586fe639ac179e95bdc150ebdbab0312f31dc30 LFR_basic-parameters -be0dc1c1876987307ddfc0fb47044f6d41815866 header/lfr_common_headers +611fe904e4b4e05736a8a618c561980d10bceead header/lfr_common_headers diff --git a/FSW-qt/fsw-qt.pro b/FSW-qt/fsw-qt.pro --- a/FSW-qt/fsw-qt.pro +++ b/FSW-qt/fsw-qt.pro @@ -12,7 +12,7 @@ SWVERSION=-1-0 DEFINES += SW_VERSION_N1=2 # major DEFINES += SW_VERSION_N2=0 # minor DEFINES += SW_VERSION_N3=2 # patch -DEFINES += SW_VERSION_N4=2 # internal +DEFINES += SW_VERSION_N4=3 # internal # #QMAKE_CFLAGS_RELEASE += -fprofile-arcs -ftest-coverage diff --git a/python_scripts/LFRControlPlugin_reload_fsw.py b/python_scripts/LFRControlPlugin_reload_fsw.py new file mode 100644 --- /dev/null +++ b/python_scripts/LFRControlPlugin_reload_fsw.py @@ -0,0 +1,13 @@ +# LOAD FSW USING LINK 1 +SpwPlugin0.StarDundeeSelectLinkNumber( 1 ) + +dsu3plugin0.openFile("/opt/DEV_PLE/FSW-qt/bin/fsw") +dsu3plugin0.loadFile() + +dsu3plugin0.run() + +# START SENDING TIMECODES AT 1 Hz +SpwPlugin0.StarDundeeStartTimecodes( 1 ) + +# it is possible to change the time code frequency +#RMAPPlugin0.changeTimecodeFrequency(2) diff --git a/python_scripts/LFRControlPlugin_reload_timegen.py b/python_scripts/LFRControlPlugin_reload_timegen.py new file mode 100644 --- /dev/null +++ b/python_scripts/LFRControlPlugin_reload_timegen.py @@ -0,0 +1,12 @@ +# LOAD FSW USING LINK 1 +SpwPlugin0.StarDundeeSelectLinkNumber( 2 ) + +dsu3plugin0.openFile("/opt/DEV_PLE/timegen-qt/bin/timegen") +dsu3plugin0.loadFile() + +dsu3plugin0.run() + +# START SENDING TIMECODES AT 1 Hz +SpwPlugin0.StarDundeeStartTimecodes( 1 ) + +SpwPlugin0.StarDundeeSelectLinkNumber( 1 ) diff --git a/python_scripts/LFRControlPlugin_startFsw.py b/python_scripts/LFRControlPlugin_startFsw.py new file mode 100644 --- /dev/null +++ b/python_scripts/LFRControlPlugin_startFsw.py @@ -0,0 +1,29 @@ +#!/usr/bin/lppmon -e + +import time + +proxy.loadSysDriver("SpwPlugin","SpwPlugin0") +SpwPlugin0.selectBridge("STAR-Dundee Spw USB Brick") + +proxy.loadSysDriverToParent("dsu3plugin","SpwPlugin0") +proxy.loadSysDriverToParent("LFRControlPlugin","SpwPlugin0") + +availableBrickCount = SpwPlugin0.StarDundeeGetAvailableBrickCount() +print "availableBrickCount = ", availableBrickCount + +SpwPlugin0.StarDundeeSelectBrick(1) +SpwPlugin0.StarDundeeSetBrickAsARouter(1) +SpwPlugin0.connectBridge() + +#SpwPlugin0.TCPServerSetIP("127.0.0.1") +SpwPlugin0.TCPServerConnect() + +#LFRControlPlugin0.SetSpwServerIP(129,104,27,164) +LFRControlPlugin0.TCPServerConnect() + +dsu3plugin0.openFile("/opt/DEV_PLE/FSW-qt/bin/fsw") +dsu3plugin0.loadFile() +dsu3plugin0.run() + +LFRControlPlugin0.TMEchoBridgeOpenPort() + diff --git a/src/fsw_spacewire.c b/src/fsw_spacewire.c --- a/src/fsw_spacewire.c +++ b/src/fsw_spacewire.c @@ -660,7 +660,7 @@ void timecode_irq_handler( void *pDev, v grspwPtr = (unsigned int *) (REGS_ADDR_GRSPW + APB_OFFSET_GRSPW_TIME_REGISTER); - housekeeping_packet.hk_lfr_dpu_spw_last_timc = (unsigned char) (grspwPtr[0] & 0x3f); // [11 1111] + housekeeping_packet.hk_lfr_dpu_spw_last_timc = (unsigned char) (grspwPtr[0] & 0xff); // [11 1111] // update the number of valid timecodes that have been received if (housekeeping_packet.hk_lfr_dpu_spw_tick_out_cnt == 255) diff --git a/src/tc_handler.c b/src/tc_handler.c --- a/src/tc_handler.c +++ b/src/tc_handler.c @@ -426,10 +426,12 @@ int check_transition_date( unsigned int { localCoarseTime = time_management_regs->coarse_time & 0x7fffffff; + PRINTF2("localTime = %x, transitionTime = %x\n", localCoarseTime, transitionCoarseTime) + if ( transitionCoarseTime <= localCoarseTime ) // SSS-CP-EQS-322 { status = LFR_DEFAULT; - PRINTF2("ERR *** in check_transition_date *** transition = %x, local = %x\n", transitionCoarseTime, localCoarseTime) + PRINTF("ERR *** in check_transition_date *** transitionCoarseTime <= localCoarseTime\n") } if (status == LFR_SUCCESSFUL) @@ -768,7 +770,6 @@ void launch_waveform_picker( unsigned ch waveform_picker_regs->start_date = transitionCoarseTime; } - PRINTF1("commutation coarse time = %x\n", transitionCoarseTime) } void launch_spectral_matrix( void ) diff --git a/src/wf_handler.c b/src/wf_handler.c --- a/src/wf_handler.c +++ b/src/wf_handler.c @@ -1294,7 +1294,7 @@ void set_wfp_delta_f0_f0_2( void ) delta_f0_in_float =nb_samples_per_snapshot / 2. * ( 1. / 256. - 1. / 24576.) * 256.; waveform_picker_regs->delta_f0 = delta_snapshot - floor( delta_f0_in_float ); - waveform_picker_regs->delta_f0_2 = 0x7; // max 7 bits + waveform_picker_regs->delta_f0_2 = 0x30; // 48 = 11 0000, max 7 bits } void set_wfp_delta_f1( void ) diff --git a/timegen-qt/src/fsw_spacewire.c b/timegen-qt/src/fsw_spacewire.c --- a/timegen-qt/src/fsw_spacewire.c +++ b/timegen-qt/src/fsw_spacewire.c @@ -615,6 +615,8 @@ void timecode_irq_handler( void *pDev, v { struct grgpio_regs_str *grgpio_regs = (struct grgpio_regs_str *) REGS_ADDR_GRGPIO; + incrementLocalCoarseTime(); + //******* // GPIO 2 if ( get_transitionCoarseTime() == getLocalCoarseTime() ) @@ -659,6 +661,7 @@ rtems_task updt_task(rtems_task_argument rtems_event_set event_out; rtems_status_code status; rtems_id queue_id; + unsigned int coarseTimeToSend; Packet_TC_LFR_UPDATE_TIME_WITH_HEADER_t update_time_packet; @@ -692,9 +695,9 @@ rtems_task updt_task(rtems_task_argument while(true){ rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); // wait for an SPW_LINKERR_EVENT - incrementLocalCoarseTime(); - updateTimePacket( getLocalCoarseTime() , &update_time_packet); - printf("UPDT will send %x as coarse time in 700 ms\n", getLocalCoarseTime()); + coarseTimeToSend = getLocalCoarseTime() + 1; + updateTimePacket( coarseTimeToSend, &update_time_packet); + printf("UPDT will send %x as coarse time in 700 ms\n", coarseTimeToSend); rtems_task_wake_after( 70 ); // 70 => 700 ms diff --git a/timegen-qt/src/tc_handler.c b/timegen-qt/src/tc_handler.c --- a/timegen-qt/src/tc_handler.c +++ b/timegen-qt/src/tc_handler.c @@ -141,14 +141,16 @@ int action_disable_calibration(ccsdsTele int action_update_time(ccsdsTelecommandPacket_t *TC) { unsigned int incomingCoarseTime; + unsigned int currentLocalCoarseTime; incomingCoarseTime = (TC->dataAndCRC[0] << 24) + (TC->dataAndCRC[1] << 16) + (TC->dataAndCRC[2] << 8) + TC->dataAndCRC[3]; + currentLocalCoarseTime = getLocalCoarseTime(); setLocalCoarseTime( incomingCoarseTime ); - printf( "localCoarseTime set to: %x\n", getLocalCoarseTime() ); + printf( "currentLocalCoarseTime = %x, localCoarseTime set to: %x\n", currentLocalCoarseTime, getLocalCoarseTime() ); return LFR_SUCCESSFUL; } diff --git a/timegen-qt/timegen-qt.pro b/timegen-qt/timegen-qt.pro --- a/timegen-qt/timegen-qt.pro +++ b/timegen-qt/timegen-qt.pro @@ -11,7 +11,7 @@ SWVERSION=-1-0 DEFINES += SW_VERSION_N1=0 # major DEFINES += SW_VERSION_N2=0 # minor DEFINES += SW_VERSION_N3=0 # patch -DEFINES += SW_VERSION_N4=1 # internal +DEFINES += SW_VERSION_N4=2 # internal contains( CONFIG, debug_tch ) { DEFINES += DEBUG_TCH