Slowed down sending data to chips

This commit is contained in:
Kevin Santo Cappuccio 2024-03-04 11:39:07 -08:00
parent c0c3cf462e
commit f5d41711f6
2 changed files with 58 additions and 51 deletions

View File

@ -28,81 +28,81 @@ void isrFromPio(void)
{ {
case CHIP_A: case CHIP_A:
{ {
digitalWriteFast(CS_A, HIGH); digitalWrite(CS_A, HIGH);
break; break;
} }
case CHIP_B: case CHIP_B:
{ {
digitalWriteFast(CS_B, HIGH); digitalWrite(CS_B, HIGH);
break; break;
} }
case CHIP_C: case CHIP_C:
{ {
digitalWriteFast(CS_C, HIGH); digitalWrite(CS_C, HIGH);
break; break;
} }
case CHIP_D: case CHIP_D:
{ {
digitalWriteFast(CS_D, HIGH); digitalWrite(CS_D, HIGH);
break; break;
} }
case CHIP_E: case CHIP_E:
{ {
digitalWriteFast(CS_E, HIGH); digitalWrite(CS_E, HIGH);
break; break;
} }
case CHIP_F: case CHIP_F:
{ {
digitalWriteFast(CS_F, HIGH); digitalWrite(CS_F, HIGH);
break; break;
} }
case CHIP_G: case CHIP_G:
{ {
digitalWriteFast(CS_G, HIGH); digitalWrite(CS_G, HIGH);
break; break;
} }
case CHIP_H: case CHIP_H:
{ {
digitalWriteFast(CS_H, HIGH); digitalWrite(CS_H, HIGH);
break; break;
} }
case CHIP_I: case CHIP_I:
{ {
digitalWriteFast(CS_I, HIGH); digitalWrite(CS_I, HIGH);
break; break;
} }
case CHIP_J: case CHIP_J:
{ {
digitalWriteFast(CS_J, HIGH); digitalWrite(CS_J, HIGH);
break; break;
} }
case CHIP_K: case CHIP_K:
{ {
digitalWriteFast(CS_K, HIGH); digitalWrite(CS_K, HIGH);
break; break;
} }
case CHIP_L: case CHIP_L:
{ {
digitalWriteFast(CS_L, HIGH); digitalWrite(CS_L, HIGH);
break; break;
} }
} }
delayMicroseconds(2); delayMicroseconds(6);
digitalWriteFast(CS_A, LOW); digitalWrite(CS_A, LOW);
digitalWriteFast(CS_B, LOW); digitalWrite(CS_B, LOW);
digitalWriteFast(CS_C, LOW); digitalWrite(CS_C, LOW);
digitalWriteFast(CS_D, LOW); digitalWrite(CS_D, LOW);
digitalWriteFast(CS_E, LOW); digitalWrite(CS_E, LOW);
digitalWriteFast(CS_F, LOW); digitalWrite(CS_F, LOW);
digitalWriteFast(CS_G, LOW); digitalWrite(CS_G, LOW);
digitalWriteFast(CS_H, LOW); digitalWrite(CS_H, LOW);
digitalWriteFast(CS_I, LOW); digitalWrite(CS_I, LOW);
digitalWriteFast(CS_J, LOW); digitalWrite(CS_J, LOW);
digitalWriteFast(CS_K, LOW); digitalWrite(CS_K, LOW);
digitalWriteFast(CS_L, LOW); digitalWrite(CS_L, LOW);
delayMicroseconds(1); delayMicroseconds(4);
irq_flags = pio0_hw->irq; irq_flags = pio0_hw->irq;
pio_interrupt_clear(pio, PIO0_IRQ_0); pio_interrupt_clear(pio, PIO0_IRQ_0);
hw_clear_bits(&pio0_hw->irq, irq_flags); hw_clear_bits(&pio0_hw->irq, irq_flags);
@ -128,26 +128,26 @@ void initCH446Q(void)
uint offset = pio_add_program(pio, &spi_ch446_multi_cs_program); uint offset = pio_add_program(pio, &spi_ch446_multi_cs_program);
// uint offsetCS = pio_add_program(pio, &spi_ch446_cs_handler_program); // uint offsetCS = pio_add_program(pio, &spi_ch446_cs_handler_program);
Serial.print("offset: "); // Serial.print("offset: ");
Serial.println(offset); // Serial.println(offset);
pio_spi_ch446_multi_cs_init(pio, sm, offset, 8, 16, 0, 1, clk, dat); pio_spi_ch446_multi_cs_init(pio, sm, offset, 8, 16, 0, 1, clk, dat);
// pio_spi_ch446_cs_handler_init(pio, smCS, offsetCS, 256, 1, 8, 20, 6); // pio_spi_ch446_cs_handler_init(pio, smCS, offsetCS, 256, 1, 8, 20, 6);
// pinMode(CS_A, OUTPUT); // pinMode(CS_A, OUTPUT);
// digitalWrite(CS_A, HIGH); // digitalWrite(CS_A, HIGH);
pinMode(CS_A, OUTPUT); pinMode(CS_A, OUTPUT_8MA);
pinMode(CS_B, OUTPUT); pinMode(CS_B, OUTPUT_8MA);
pinMode(CS_C, OUTPUT); pinMode(CS_C, OUTPUT_8MA);
pinMode(CS_D, OUTPUT); pinMode(CS_D, OUTPUT_8MA);
pinMode(CS_E, OUTPUT); pinMode(CS_E, OUTPUT_8MA);
pinMode(CS_F, OUTPUT); pinMode(CS_F, OUTPUT_8MA);
pinMode(CS_G, OUTPUT); pinMode(CS_G, OUTPUT_8MA);
pinMode(CS_H, OUTPUT); pinMode(CS_H, OUTPUT_8MA);
pinMode(CS_I, OUTPUT); pinMode(CS_I, OUTPUT_8MA);
pinMode(CS_J, OUTPUT); pinMode(CS_J, OUTPUT_8MA);
pinMode(CS_K, OUTPUT); pinMode(CS_K, OUTPUT_8MA);
pinMode(CS_L, OUTPUT); pinMode(CS_L, OUTPUT_8MA);
digitalWrite(CS_A, LOW); digitalWrite(CS_A, LOW);
digitalWrite(CS_B, LOW); digitalWrite(CS_B, LOW);
@ -162,10 +162,10 @@ void initCH446Q(void)
digitalWrite(CS_K, LOW); digitalWrite(CS_K, LOW);
digitalWrite(CS_L, LOW); digitalWrite(CS_L, LOW);
pinMode(RESETPIN, OUTPUT); pinMode(RESETPIN, OUTPUT_12MA);
digitalWrite(RESETPIN, HIGH); digitalWrite(RESETPIN, HIGH);
delay(2); delay(3);
digitalWrite(RESETPIN, LOW); digitalWrite(RESETPIN, LOW);
} }
@ -302,11 +302,11 @@ void sendXYraw(int chip, int x, int y, int setOrClear)
chAddress = chAddress << 24; chAddress = chAddress << 24;
delayMicroseconds(20); delayMicroseconds(50);
pio_sm_put(pio, sm, chAddress); pio_sm_put(pio, sm, chAddress);
delayMicroseconds(40); delayMicroseconds(80);
} }
void createXYarray(void) void createXYarray(void)

View File

@ -74,9 +74,7 @@ void setup()
USBSer1.begin(115200); USBSer1.begin(115200);
//delay(10);
///// setupAdcUsbStuff(); // I took this out because it was causing a crash on
//delay(10);
#ifdef EEPROMSTUFF #ifdef EEPROMSTUFF
EEPROM.begin(256); EEPROM.begin(256);
debugFlagInit(); debugFlagInit();
@ -101,17 +99,21 @@ void setup()
clearAllNTCC(); clearAllNTCC();
delay(20);
setupAdcUsbStuff(); // I took this out because it was causing a crash on
delay(10);
// lastNetConfirm(0); // lastNetConfirm(0);
} }
void setup1() void setup1()
{ {
delay(4);
#ifdef PIOSTUFF
initCH446Q(); initCH446Q();
#endif
// delay (4);
delay (4);
initLEDs(); initLEDs();
delay(4); delay(4);
startupColors(); startupColors();
@ -120,6 +122,10 @@ void setup1()
delay(4); delay(4);
showLEDsCore2 = 1; showLEDsCore2 = 1;
} }
char connectFromArduino = '\0'; char connectFromArduino = '\0';
@ -132,7 +138,7 @@ int baudRate = 115200;
int restoredNodeFile = 0; int restoredNodeFile = 0;
const char firmwareVersion[] = "1.3.7"; //// remember to update this const char firmwareVersion[] = "1.3.8"; //// remember to update this
void loop() void loop()
{ {
@ -347,6 +353,7 @@ skipinput:
bridgesToPaths(); bridgesToPaths();
clearLEDs(); clearLEDs();
assignNetColors(); assignNetColors();
delay(1);
// Serial.print("bridgesToPaths\n\r"); // Serial.print("bridgesToPaths\n\r");
digitalWrite(RESETPIN, LOW); digitalWrite(RESETPIN, LOW);
// showNets(); // showNets();