Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • derf/multipass
1 result
Show changes
Commits on Source (3)
...@@ -135,8 +135,6 @@ Peripheral communication: ...@@ -135,8 +135,6 @@ Peripheral communication:
### STM32F746ZG (NUCLEO-F746ZG) ### STM32F746ZG (NUCLEO-F746ZG)
Preliminary support, timers may be incorrect.
Peripheral communication: Peripheral communication:
* UART output on USART3 * UART output on USART3
......
...@@ -6,7 +6,7 @@ import serial.threaded ...@@ -6,7 +6,7 @@ import serial.threaded
import sys import sys
import time import time
cpu_freq = None counter_freq = None
timer_overflow = None timer_overflow = None
...@@ -81,12 +81,12 @@ class SerialMonitor: ...@@ -81,12 +81,12 @@ class SerialMonitor:
def handle_line(line): def handle_line(line):
if cpu_freq is not None: if counter_freq is not None:
print_line = line print_line = line
for match in re.finditer("(\d+)/(\d+) cycles", line): for match in re.finditer("(\d+)/(\d+) cycles", line):
cycles = int(match.group(1)) cycles = int(match.group(1))
overflows = int(match.group(2)) overflows = int(match.group(2))
ms = (cycles + timer_overflow * overflows) * 1000 / cpu_freq ms = (cycles + timer_overflow * overflows) * 1000 / counter_freq
match_line = f"{cycles}/{overflows} cycles" match_line = f"{cycles}/{overflows} cycles"
new_line = f"{ms} ms ({cycles}/{overflows} cycles)" new_line = f"{ms} ms ({cycles}/{overflows} cycles)"
print_line = re.sub(match_line, new_line, print_line) print_line = re.sub(match_line, new_line, print_line)
...@@ -100,9 +100,9 @@ if __name__ == "__main__": ...@@ -100,9 +100,9 @@ if __name__ == "__main__":
baud = int(sys.argv[2]) baud = int(sys.argv[2])
if len(sys.argv) > 4: if len(sys.argv) > 4:
cpu_freq = int(sys.argv[3]) counter_freq = int(sys.argv[3])
timer_overflow = int(sys.argv[4]) timer_overflow = int(sys.argv[4])
monitor = SerialMonitor(tty, baud, handle_line) monitor = SerialMonitor(tty, baud, handle_line)
time.sleep(5) time.sleep(20)
monitor.close() monitor.close()
...@@ -105,6 +105,9 @@ program: build/system.elf ...@@ -105,6 +105,9 @@ program: build/system.elf
arch_clean: arch_clean:
${QUIET}rm -f ${OBJECTS} ${QUIET}rm -f ${OBJECTS}
cat:
${QUIET}script/cat.py /dev/${SERIAL_PORT} 115200 ${counter_freq} 4294967295
monitor: monitor:
${QUIET}screen /dev/${SERIAL_PORT} 19200 ${QUIET}screen /dev/${SERIAL_PORT} 19200
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
SERIAL_PORT ?= ttyACM0 SERIAL_PORT ?= ttyACM0
cpu_freq ?= 216000000 cpu_freq ?= 216000000
counter_freq ?= 108000000
INCLUDES += -Iext/libopencm3/include INCLUDES += -Iext/libopencm3/include
...@@ -114,7 +115,7 @@ arch_clean: ...@@ -114,7 +115,7 @@ arch_clean:
${QUIET}rm -f ${OBJECTS} ${QUIET}rm -f ${OBJECTS}
cat: cat:
${QUIET}script/cat.py /dev/${SERIAL_PORT} 115200 ${cpu_freq} 65536 ${QUIET}script/cat.py /dev/${SERIAL_PORT} 115200 ${counter_freq} 4294967296
monitor: monitor:
${QUIET}screen /dev/${SERIAL_PORT} 115200 ${QUIET}screen /dev/${SERIAL_PORT} 115200
...@@ -126,9 +127,8 @@ arch_help: ...@@ -126,9 +127,8 @@ arch_help:
arch_info: arch_info:
@echo "CPU Freq: ${cpu_freq} Hz" @echo "CPU Freq: ${cpu_freq} Hz"
@echo "Timer Freq: ${timer_freq} Hz -> $(shell src/arch/stm32f746zg-nucleo/model.py f_timer "${cpu_freq}" "${timer_freq}")" @echo "Count Freq: ${counter_freq} Hz"
@echo "I2C Freq: ${i2c_freq} Hz" @echo "Counter Overflow: 4294967296/4294967295"
@echo "Counter Overflow: 4294967296/255"
@echo "Monitor: /dev/${SERIAL_PORT} 115200" @echo "Monitor: /dev/${SERIAL_PORT} 115200"
attributes: build/system.elf attributes: build/system.elf
......
...@@ -21,6 +21,7 @@ void Arch::setup(void) ...@@ -21,6 +21,7 @@ void Arch::setup(void)
#error Unsupported F_CPU #error Unsupported F_CPU
#endif #endif
#ifdef CONFIG_arch_stm32f746zg_nucleo_driver_counter
// counter // counter
rcc_periph_clock_enable(RCC_TIM2); rcc_periph_clock_enable(RCC_TIM2);
nvic_enable_irq(NVIC_TIM2_IRQ); nvic_enable_irq(NVIC_TIM2_IRQ);
...@@ -32,6 +33,7 @@ void Arch::setup(void) ...@@ -32,6 +33,7 @@ void Arch::setup(void)
timer_continuous_mode(TIM2); timer_continuous_mode(TIM2);
timer_set_period(TIM2, 4294967295); timer_set_period(TIM2, 4294967295);
timer_enable_irq(TIM2, TIM_DIER_UIE); timer_enable_irq(TIM2, TIM_DIER_UIE);
#endif
#ifdef CONFIG_loop #ifdef CONFIG_loop
rcc_periph_clock_enable(RCC_TIM3); rcc_periph_clock_enable(RCC_TIM3);
......