Skip to content
Snippets Groups Projects
Commit ac70ede6 authored by Jake Read's avatar Jake Read
Browse files

notes on next psu board, updated motion head firmware: lives here now, and a...

notes on next psu board, updated motion head firmware: lives here now, and a big bus update that is hopefully much more resilient, and a little faster
parent c1124c8a
Branches
No related tags found
No related merge requests found
...@@ -14,6 +14,7 @@ This is a circuit & mount for a small desktop DC PSU and embedded system bus-hea ...@@ -14,6 +14,7 @@ This is a circuit & mount for a small desktop DC PSU and embedded system bus-hea
- clear LED indication of 24v presence, 5v presence on bus - clear LED indication of 24v presence, 5v presence on bus
### What's Up: ### What's Up:
- uses [the module](https://gitlab.cba.mit.edu/jakeread/ucbus-module) - uses [the module](https://gitlab.cba.mit.edu/jakeread/ucbus-module)
- breaks out 24V 350W & UCBus on one 2x15 IDC - breaks out 24V 350W & UCBus on one 2x15 IDC
- second 24V 40W UCBus channel available - second 24V 40W UCBus channel available
......
...@@ -32,6 +32,7 @@ boolean smoothie_is_moving(void){ ...@@ -32,6 +32,7 @@ boolean smoothie_is_moving(void){
EP_ONDATA_RESPONSES onMoveData(uint8_t* data, uint16_t len){ EP_ONDATA_RESPONSES onMoveData(uint8_t* data, uint16_t len){
// can we load it? // can we load it?
if(!conveyor->is_queue_full()){ if(!conveyor->is_queue_full()){
DEBUG3PIN_TOGGLE;
// read from head, // read from head,
uint16_t ptr = 0; uint16_t ptr = 0;
// feedrate is 1st, // feedrate is 1st,
...@@ -227,50 +228,17 @@ void setup() { ...@@ -227,50 +228,17 @@ void setup() {
// r8 settings // r8 settings
osapAddVertex(rateSettingsEp); // 8 osapAddVertex(rateSettingsEp); // 8
// smoothie (and frequency of loop below) // smoothie (and frequency of loop below)
#warning pls reconsider maximal rates / etc given new loop freq... and how / where to parameterize
smoothieRoll->init(20000); smoothieRoll->init(20000);
// bare serial
//Serial.begin(9600);
// barebus
//ucBusHead_setup();
// 25kHz base (40us period) or // 25kHz base (40us period) or
// 20kHz base (50us period) // 20kHz base (50us period)
d51ClockBoss->start_ticker_a(50); d51ClockBoss->start_ticker_a(50);
} }
//#define TEST_TX
#ifdef TEST_TX
unsigned long lastTx = 0;
uint8_t testTx[33] = {
1, 2, 3, 4, 0, 6, 7, 8, 9, 10,
11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
31, 32, 33 };
uint8_t tstRx[256];
#endif
void loop() { void loop() {
// write ~ every second, transmit on chb to drop 1 // write ~ every second, transmit on chb to drop 1
// check indices on the way down / up ... was shifting, are not anymore // check indices on the way down / up ... was shifting, are not anymore
osapLoop(); osapLoop();
conveyor->on_idle(nullptr); conveyor->on_idle(nullptr);
#ifdef TEST_TX
if(ucBusHead_ctr(1)){
uint16_t len = ucBusHead_read(1, tstRx);
logPacket(tstRx, len);
}
if(millis() > lastTx + 100){
lastTx = millis();
if(ucBusHead_ctsB(1)){
//logPacket(testTx, 15);
ucBusHead_transmitB(testTx, 22, 1);
DEBUG1PIN_TOGGLE;
}
}
#endif
} // end loop } // end loop
// runs on period defined by timer_a setup: // runs on period defined by timer_a setup:
...@@ -287,19 +255,18 @@ void TC0_Handler(void){ ...@@ -287,19 +255,18 @@ void TC0_Handler(void){
timeTick ++; timeTick ++;
timeBlink ++; timeBlink ++;
if(timeBlink > blinkTime){ if(timeBlink > blinkTime){
//DEBUG1PIN_TOGGLE; DEBUG1PIN_TOGGLE;
timeBlink = 0; timeBlink = 0;
} }
// do bus action first: want downstream clocks to be deterministic-ish // do bus action first: want downstream clocks to be deterministic-ish
ucBusHead_timerISR(); ucBusHead_timerISR();
// do step tick // do step tick
/*
smoothieRoll->step_tick(); smoothieRoll->step_tick();
// every n ticks, ship position? // 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 // 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. // which would occupy the full bus - notgood - or we can do every 3rd... I'll pick every 4th.
if(timeTick > 3){ if(timeTick > 3){
DEBUG2PIN_TOGGLE; DEBUG2PIN_HI;
timeTick = 0; timeTick = 0;
uint16_t mpptr = 0; // motion packet pointer uint16_t mpptr = 0; // motion packet pointer
if(planner->do_set_position){ if(planner->do_set_position){
...@@ -314,9 +281,7 @@ void TC0_Handler(void){ ...@@ -314,9 +281,7 @@ void TC0_Handler(void){
ts_writeFloat32(smoothieRoll->actuators[2]->floating_position, motion_packet, &mpptr); ts_writeFloat32(smoothieRoll->actuators[2]->floating_position, motion_packet, &mpptr);
ts_writeFloat32(smoothieRoll->actuators[3]->floating_position, motion_packet, &mpptr); ts_writeFloat32(smoothieRoll->actuators[3]->floating_position, motion_packet, &mpptr);
// write packet, put on ucbus // write packet, put on ucbus
//DEBUG3PIN_ON; ucBusHead_transmitA(motion_packet, 17);
//ucBusHead_transmitA(motion_packet, 17); DEBUG2PIN_LO;
//DEBUG3PIN_OFF;
} }
*/
} }
Subproject commit af5f9a0e004a6134b38f0f1996bebda271f9c655 Subproject commit eeabe1a173dc1c7270b0099a7a1a0e0e7735e1be
...@@ -121,7 +121,8 @@ void Conveyor::on_idle(void*) ...@@ -121,7 +121,8 @@ void Conveyor::on_idle(void*)
// Cleanly delete block // Cleanly delete block
Block* block = queue.tail_ref(); Block* block = queue.tail_ref();
// if not-super-full, light on: buffer close to starving // if not-super-full, light on: buffer close to starving
(queue.space() > 32) ? DEBUG2PIN_ON : DEBUG2PIN_OFF; #warning this was useful w/ buffer starvation debug / indication
// (queue.space() > 32) ? DEBUG2PIN_ON : DEBUG2PIN_OFF;
/* /*
sysError(String(block->millimeters) + " " sysError(String(block->millimeters) + " "
+ String(block->entry_speed) + " " + String(block->entry_speed) + " "
...@@ -259,6 +260,8 @@ void Conveyor::check_queue(bool force) ...@@ -259,6 +260,8 @@ void Conveyor::check_queue(bool force)
// called from step ticker ISR // called from step ticker ISR
bool Conveyor::get_next_block(Block **block){ bool Conveyor::get_next_block(Block **block){
// indicate consumption
DEBUG4PIN_TOGGLE;
// mark entire queue for GC if flush flag is asserted // mark entire queue for GC if flush flag is asserted
if (flush){ if (flush){
while (queue.isr_tail_i != queue.head_i) { while (queue.isr_tail_i != queue.head_i) {
......
...@@ -10,3 +10,23 @@ OK, through most of the setup. ...@@ -10,3 +10,23 @@ OK, through most of the setup.
- label cut-jumpers, config auto - label cut-jumpers, config auto
OK, done. OK, done.
## Next Revision
**2021 08 09**
I get a lot of use out of these and it would be useful if they had a few more features.
- ferrite bead, maybe SMT? inspect gnd plane when something is consuming power (i.e. the A4950 drivers), there's a 20kHz wobble (about +/- 1V!) and a longer mode ~ maybe 1kHz or so.
- 24v remote shutoff, and might as well add reverse polarity protection if it's easy
- 24v should auto-shutoff when logic is removed, presumably can pull the shutoff gate low
- 24v power sense w/ shunt resistor
- hardware 'power-present' led,
- 5v (!) remote shutoff: helps when debugging, to remote reset everything down-branch
- more intentional packaging with the PSU itself, current situation a little awkward.
- one 30pin and one 10pin connector, same lines, don't bother with 2nd RS485 link
- *so many* debug LEDs
- keep this option for i2c display
- some... buttons ?
- label the 5v select jumpers,
- I had more notes about this somewhere else... see if you can find old haystack log
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment