Hi,
Maybe this is a bit necro-posting but I am trying to adapt this solution to another instrument and another MCU. I am working on a damaged E3632a which appears to share a lot of HW/design with 34401a, it did not survive shipping and complete front panel is in pieces. VFD did not survive and other parts suffered as well... so trying to see what I could save and cannot verify what is really operational control wise. There is some life but faar from ideal.
Changes for me are using ESP32 instead of STM32 and after adapting the platform, I get a lot of errors with decoding. ESP32 runs at 240Mhz/40Mhz crystal so speed should not be an issue. Using external interrupt to capture following 8 bits per original routine. For now I don't output to LCD/Oled and modified the SW (interrupt routine) to ESP32. I read all bytes to a char buffer dumping them to serial only once every 500 EOF messages.
So there shouldn't be loop/delay issues while collecting 500 samples since I am not triggering serial output more than once every 500 messages. Also I set baud to 1Mbit on both ESP32 and the terminal.
void IRAM_ATTR sckInterrupt() {
// mid byte power on detection
now_us = micros();
if (byte_len != 0 && (now_us > (last_us + 1500))) { //MAX_SCK_DELAY
byte_len = 0;
}
last_us = now_us;
output_acc = (output_acc << 1) + ((GPIO.in >> 23) & 1);
input_acc = (input_acc << 1) + ((GPIO.in >> 18) & 1);
byte_len++;
if (byte_len == 8) {
if (byte_ready) {
byte_not_read = true;
}
input_byte = input_acc;
output_byte = output_acc;
byte_len = 0;
byte_ready = true;
}
}
void startSniffing() {
attachInterrupt(digitalPinToInterrupt(19), &sckInterrupt, RISING);
}
inline void endFrame() {
buf_len = 0;
frame_state = UNKNOWN;
mi++;
if(mi == 500) {
for(int z=0; z<mi; z++) {
for(int x=0; x<15; x++)
Serial.print(mb[z][x], HEX);
Serial.println(".");
}
mi = 0;
}
}
By default it says " OUTPUT OFF " for a message type decode but we can clearly see bits missing/errors in some of the messages. I am a bit lost as to why would this be other than perhaps HW fault.
14:56:20.802 -> 204F5554505554204F464620000.
14:56:20.802 -> 204F5554505554204F464620000.
14:56:20.802 -> 204F5554505554204F464620000.
14:56:20.802 -> 204F5554505554204F464620000.
14:56:20.852 -> 204F5554505554204F464620000.
14:56:20.852 -> 204F5554505554204F464620000.
14:56:20.852 -> 204F5554505554204F464620000.
14:56:20.852 -> 204F5554505554204F464620000.
14:56:20.852 -> 204F555450555C204F464620000.
14:56:20.852 -> 204F5554505554204F464620000.
14:56:20.852 -> 204F5554505554204F464620000.
14:56:20.852 -> 204F5554505554204F464620000.
14:56:20.852 -> 204F5554505554204F464620000.
14:56:20.852 -> 204F5554505554204F464620000.
14:56:20.852 -> 204F5554505554204F464620000.
14:56:20.852 -> 204F5554505554204F464620000.
14:56:20.852 -> 204F5554505554204F464620000.
14:56:20.852 -> 04F5554505554204F464620000.
14:56:20.852 -> 204F7554505554204F464620000.
14:56:20.852 -> 204F5554505554204F464620000.
14:56:20.852 -> 204F5554505554204F464620000.
14:56:20.852 -> 204F5554505574204F464620000.
14:56:20.852 -> 204F555450555404F464620000.
14:56:20.852 -> 204F5554505550204F464620000.
14:56:20.852 -> 204F555C505554204F464620000.
14:56:20.852 -> 204F5554501554204F464620000.
14:56:20.852 -> 204F5554505554204F464620000.