From 75ebaa6cba951fdaf7ed050c708b981708c53d14 Mon Sep 17 00:00:00 2001 From: Jake Read <jake.read@cba.mit.edu> Date: Wed, 17 Nov 2021 16:10:08 -0500 Subject: [PATCH] new bus head for easy delimit --- firmware/motion-head/src/main.cpp | 29 +++++++++++++++-------------- firmware/motion-head/src/osape-d51 | 2 +- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/firmware/motion-head/src/main.cpp b/firmware/motion-head/src/main.cpp index f6c7ceb..534da6e 100644 --- a/firmware/motion-head/src/main.cpp +++ b/firmware/motion-head/src/main.cpp @@ -203,9 +203,6 @@ void setup() { DEBUG2PIN_SETUP; DEBUG3PIN_SETUP; DEBUG4PIN_SETUP; - // l i g h t s - ERRLIGHT_ON; - CLKLIGHT_ON; // osap osapSetup(); // ports @@ -231,7 +228,7 @@ void setup() { smoothieRoll->init(20000); // 25kHz base (40us period) or // 20kHz base (50us period) - d51ClockBoss->start_ticker_a(100); + d51ClockBoss->start_ticker_a(50); } void loop() { @@ -242,7 +239,7 @@ void loop() { } // end loop // runs on period defined by timer_a setup: -volatile uint16_t timeTick = 0; +volatile uint32_t timeTick = 0; volatile uint64_t timeBlink = 0; uint16_t blinkTime = 1000; @@ -252,22 +249,17 @@ void TC0_Handler(void){ // runs at period established above... TC0->COUNT32.INTFLAG.bit.MC0 = 1; TC0->COUNT32.INTFLAG.bit.MC1 = 1; - DEBUG1PIN_TOGGLE; - timeTick ++; - timeBlink ++; - if(timeBlink > blinkTime){ - //DEBUG1PIN_TOGGLE; - CLKLIGHT_TOGGLE; - sysErrLightCheck(); - timeBlink = 0; - } + DEBUG1PIN_HI; + // do bus action first: want downstream clocks to be deterministic-ish ucBusHead_timerISR(); + // do step tick smoothieRoll->step_tick(); // every n ticks, ship position? // each of these ticks drops 10 data bytes, so if we have 17 byte packet, can do every 2nd packet // which would occupy the full bus - notgood - or we can do every 3rd... I'll pick every 4th. + timeTick ++; if(timeTick > 3){ DEBUG2PIN_HI; timeTick = 0; @@ -287,4 +279,13 @@ void TC0_Handler(void){ ucBusHead_transmitA(motion_packet, 17); DEBUG2PIN_LO; } + + // do blinking, lol + timeBlink ++; + if(timeBlink > blinkTime){ + CLKLIGHT_TOGGLE; + sysErrLightCheck(); + timeBlink = 0; + } + DEBUG1PIN_LO; } diff --git a/firmware/motion-head/src/osape-d51 b/firmware/motion-head/src/osape-d51 index 0beaf06..2694d0c 160000 --- a/firmware/motion-head/src/osape-d51 +++ b/firmware/motion-head/src/osape-d51 @@ -1 +1 @@ -Subproject commit 0beaf064563e5773f2979d09ad40cefd786ca383 +Subproject commit 2694d0c983f0da1679cceb31b41d79e128a2b81d -- GitLab