diff --git a/firmware/include_board/board_common.h b/firmware/include_board/board_common.h index eda500f0..fec8a05d 100644 --- a/firmware/include_board/board_common.h +++ b/firmware/include_board/board_common.h @@ -63,7 +63,7 @@ /** UART0 */ /** Console baudrate always using 115200. */ -#define CONSOLE_BAUDRATE 230400 +#define CONSOLE_BAUDRATE 115200 /** Usart Hw interface used by the console (UART0). */ #define CONSOLE_USART UART0 /** Usart Hw ID used by the console (UART0). */ diff --git a/firmware/src_simtrace/main.c b/firmware/src_simtrace/main.c index c4e6f3c1..c4df7bcb 100644 --- a/firmware/src_simtrace/main.c +++ b/firmware/src_simtrace/main.c @@ -133,24 +133,72 @@ extern int main(void) g_unique_id[2], g_unique_id[3]); #if 1 + +static const unsigned char __eeprom_bin[] = { + 0x23, 0x42, 0x17, 0x25, 0x00, 0x00, 0x9b, 0x20, 0x01, 0xa0, 0x00, 0x5e, + 0x01, 0x32, 0x01, 0x32, 0x32, 0x04, 0x09, 0x18, 0x0d, 0x00, 0x73, 0x00, + 0x79, 0x00, 0x73, 0x00, 0x6d, 0x00, 0x6f, 0x00, 0x63, 0x00, 0x6f, 0x00, + 0x6d, 0x00, 0x20, 0x00, 0x2d, 0x00, 0x20, 0x00, 0x73, 0x00, 0x2e, 0x00, + 0x66, 0x00, 0x2e, 0x00, 0x6d, 0x00, 0x2e, 0x00, 0x63, 0x00, 0x2e, 0x00, + 0x20, 0x00, 0x47, 0x00, 0x6d, 0x00, 0x62, 0x00, 0x48, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x71, 0x00, 0x75, 0x00, 0x61, 0x00, 0x64, 0x00, 0x20, 0x00, 0x6d, 0x00, + 0x6f, 0x00, 0x64, 0x00, 0x65, 0x00, 0x6d, 0x00, 0x20, 0x00, 0x76, 0x00, + 0x31, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00 +}; +static const unsigned int __eeprom_bin_len = 256; + static const Pin pin_hub_rst = {PIO_PA13, PIOA, ID_PIOA, PIO_OUTPUT_1, PIO_DEFAULT}; PIO_Configure(&pin_hub_rst, 1); i2c_pin_init(); - while (1) { - for (i = 0; i < 256; i ++) { - int byte = eeprom_read_byte(0x50, i); - TRACE_INFO("0x%02x: %02x\r\n", i, byte); - } + + /* wait */ + volatile int v; + /* 440ns per cycle here */ + for (i = 0; i < 1000000; i++) { + v = 0; } + + /* write the EEPROM once */ + for (i = 0; i < 256; i++) { + int rc = eeprom_write_byte(0x50, i, __eeprom_bin[i]); + /* if the result was negative, repeat that write */ + if (rc < 0) + i--; + } + + /* then pursue re-reading it again and again */ + for (i = 0; i < 256; i++) { + int byte = eeprom_read_byte(0x50, i); + TRACE_INFO("0x%02x: %02x\r\n", i, byte); + if (byte != __eeprom_bin[i]) + TRACE_ERROR("Byte %u is wrong, expected 0x%02x, found 0x%02x\r\n", + i, __eeprom_bin[i], byte); + } + PIO_Clear(&pin_hub_rst); #endif TRACE_INFO("USB init...\r\n"); while (USBD_GetState() < USBD_STATE_CONFIGURED) { +#if 0 if (i >= MAX_USB_ITER * 3) { TRACE_ERROR("Resetting board (USB could " "not be configured)\r\n"); NVIC_SystemReset(); } +#endif i++; }