-
-
Notifications
You must be signed in to change notification settings - Fork 7
Closed
Labels
platform: EV3Issues related to LEGO MINDSTORMS EV3Issues related to LEGO MINDSTORMS EV3software: pybricks-micropythonIssues with Pybricks MicroPython firmware (or EV3 runtime)Issues with Pybricks MicroPython firmware (or EV3 runtime)
Description
While a program is running (the display animation is running), some ADC operations appear to take about 7x longer.
start complete duration (microseconds)
150521076 150523056 1980
150523897 150538786 14889
150538625 150541258 2633
150541099 150543258 2159
150543099 150545240 2141
150545082 150547239 2157
150547080 150549260 2180
150549098 150551263 2165
150551100 150553261 2161
150553099 150555243 2144
150555080 150557251 2171
150557099 150559259 2160
150559097 150561242 2145
150561111 150563056 1945
150563897 150578969 15072
150578808 150581241 2433
150581082 150583258 2176
150583099 150585257 2158
150585099 150587240 2141
150587081 150589261 2180
150589098 150591240 2142
150591081 150593260 2179
150593098 150595261 2163
150595098 150597262 2164
150597099 150599262 2163
150599099 150601263 2164
150601100 150604296 3196
150604138 150619102 14964
150618973 150621259 2286
150621100 150623258 2158
150623099 150625256 2157
150625097 150627256 2159
150627098 150629257 2159
150629099 150631258 2159
150631099 150633259 2160
150633097 150635262 2165
150635099 150637260 2161
150637098 150639261 2163
When no program is running, it is more consistently near 2160 microseconds.
(We can also update the wait in the loop to use pbio_os_timer_extend, with a longer loop time than the average duration. That's not the issue here though.)
--- a/lib/pbio/drv/block_device/block_device_ev3.c
+++ b/lib/pbio/drv/block_device/block_device_ev3.c
@@ -43,6 +43,9 @@
#include <pbio/int_math.h>
#include <pbio/util.h>
+
+#include <pbdrv/../../drv/uart/uart_debug_first_port.h>
+
//
// Part 1: Common SPI setup and DMA configuration.
//
@@ -115,6 +118,7 @@ static void spi_dma_complete(void) {
SPIIntDisable(SOC_SPI_0_REGS, SPI_DMA_REQUEST_ENA_INT);
pbio_os_request_poll();
last_spi_dma_complete_time = pbdrv_clock_get_ms();
+ pbdrv_uart_debug_printf("%lu\n", pbdrv_clock_get_us());
}
/**
@@ -813,6 +817,8 @@ static pbio_error_t pbdrv_block_device_ev3_spi_begin_for_adc(const uint32_t *cmd
EDMA3EnableTransfer(SOC_EDMA30CC_0_REGS, EDMA3_CHA_SPI0_RX, EDMA3_TRIG_MODE_EVENT);
SPIIntEnable(SOC_SPI_0_REGS, SPI_DMA_REQUEST_ENA_INT);
+ pbdrv_uart_debug_printf("%lu, ", pbdrv_clock_get_us());
+
return PBIO_SUCCESS;
}This is related to the flickering issue in #2301 since we wait on the ADC before taking a sample before toggling the light again. This could explain that variation.
Metadata
Metadata
Assignees
Labels
platform: EV3Issues related to LEGO MINDSTORMS EV3Issues related to LEGO MINDSTORMS EV3software: pybricks-micropythonIssues with Pybricks MicroPython firmware (or EV3 runtime)Issues with Pybricks MicroPython firmware (or EV3 runtime)