diff --git a/src/eez/modules/dib-mio168/dib-mio168.cpp b/src/eez/modules/dib-mio168/dib-mio168.cpp index f3d4a8515..eb505adce 100644 --- a/src/eez/modules/dib-mio168/dib-mio168.cpp +++ b/src/eez/modules/dib-mio168/dib-mio168.cpp @@ -976,6 +976,7 @@ struct Mio168Module : public Module { TestResult testResult = TEST_NONE; bool synchronized = false; int numCrcErrors = 0; + int numTransferErrors = 0; uint8_t input[sizeof(FromSlaveToMaster)]; uint8_t output[sizeof(FromSlaveToMaster)]; bool spiReady = false; @@ -1039,6 +1040,7 @@ struct Mio168Module : public Module { if (bp3c::comm::masterSynchro(slotIndex)) { synchronized = true; numCrcErrors = 0; + numTransferErrors = 0; testResult = TEST_OK; #ifdef EEZ_PLATFORM_SIMULATOR sendMessageToLowPriorityThread(THREAD_MESSAGE_FS_DRIVER_LINK, slotIndex, 0); @@ -1136,6 +1138,7 @@ struct Mio168Module : public Module { } numCrcErrors = 0; + numTransferErrors = 0; FromSlaveToMaster &data = (FromSlaveToMaster &)*input; @@ -1167,15 +1170,23 @@ struct Mio168Module : public Module { return true; } else { if (status == bp3c::comm::TRANSFER_STATUS_CRC_ERROR) { - if (++numCrcErrors >= 10) { + numCrcErrors++; + if (numCrcErrors >= 10) { event_queue::pushEvent(event_queue::EVENT_ERROR_SLOT1_CRC_CHECK_ERROR + slotIndex); synchronized = false; testResult = TEST_FAILED; - } else { - DebugTrace("Slot %d CRC %d\n", slotIndex + 1, numCrcErrors); + } else if (numCrcErrors > 5) { + DebugTrace("Slot %d CRC error no. %d\n", slotIndex + 1, numCrcErrors); } } else { - DebugTrace("Slot %d SPI transfer error %d\n", slotIndex + 1, status); + numTransferErrors++; + if (numTransferErrors >= 10) { + event_queue::pushEvent(event_queue::EVENT_ERROR_SLOT1_SYNC_ERROR + slotIndex); + synchronized = false; + testResult = TEST_FAILED; + } else if (numTransferErrors > 5) { + DebugTrace("Slot %d SPI transfer error %d no. %d\n", slotIndex + 1, status, numTransferErrors); + } } return false; diff --git a/src/eez/modules/mcu/ethernet.cpp b/src/eez/modules/mcu/ethernet.cpp index 9fb61340a..c9253f9a6 100644 --- a/src/eez/modules/mcu/ethernet.cpp +++ b/src/eez/modules/mcu/ethernet.cpp @@ -822,7 +822,32 @@ void releaseInputBuffer() { int writeBuffer(const char *buffer, uint32_t length) { #if defined(EEZ_PLATFORM_STM32) - netconn_write(g_tcpClientConnection, (void *)buffer, (uint16_t)length, NETCONN_COPY); + if (length <= 1024) { + static const size_t NUM_BUFFERS = 4; + static uint8_t g_buffers[NUM_BUFFERS][1024]; + static bool g_isBufferUsed[NUM_BUFFERS]; + + size_t i; + for (i = 0; i < NUM_BUFFERS; i++) { + if (!g_isBufferUsed[i]) { + memcpy(&g_buffers[i][0], buffer, length); + netconn_write(g_tcpClientConnection, (void *)&g_buffers[i][0], (uint16_t)length, NETCONN_NOCOPY); + g_isBufferUsed[i] = true; + break; + } + } + + if (i == NUM_BUFFERS) { + netconn_write(g_tcpClientConnection, (void *)buffer, (uint16_t)length, NETCONN_COPY); + + for (size_t i = 0; i < NUM_BUFFERS; i++) { + g_isBufferUsed[i] = false; + } + } + } else { + netconn_write(g_tcpClientConnection, (void *)buffer, (uint16_t)length, NETCONN_COPY); + } + return length; #endif diff --git a/src/third_party/stm32_cubeide/.settings/stm32cubeide.project.prefs b/src/third_party/stm32_cubeide/.settings/stm32cubeide.project.prefs index 64d8b897f..1ba9449b3 100644 --- a/src/third_party/stm32_cubeide/.settings/stm32cubeide.project.prefs +++ b/src/third_party/stm32_cubeide/.settings/stm32cubeide.project.prefs @@ -1,4 +1,4 @@ -2F62501ED4689FB349E356AB974DBE57=6324EFC706C094AE3B0AEB00227A953C -8DF89ED150041C4CBC7CB9A9CAA90856=6324EFC706C094AE3B0AEB00227A953C -DC22A860405A8BF2F2C095E5B6529F12=C8E89020F1502089B9D4C78CEB9BD12A +2F62501ED4689FB349E356AB974DBE57=618266508428BDF06C84712473DD5FAA +8DF89ED150041C4CBC7CB9A9CAA90856=618266508428BDF06C84712473DD5FAA +DC22A860405A8BF2F2C095E5B6529F12=42CF0666AD1D078F9BC5A8F2E0EF7764 eclipse.preferences.version=1