overclocking so SUMP mode can sample up to 50 MHz

This commit is contained in:
Triss 2021-07-19 03:34:48 +02:00
parent d289799393
commit 35a427e8a0
4 changed files with 19 additions and 8 deletions

View File

@ -277,6 +277,7 @@ libco is licensed under the [ISC license](https://opensource.org/licenses/ISC)
- OpenOCD as XVC client??
- [x] SUMP logic analyzer mode?
- see also [this](https://github.com/perexg/picoprobe-sump)
- [ ] runtime config options for overclocking, logging
- [ ] FT2232 emulation mode?
- watch out, still need a vnd cfg interface! libftdi expects the following stuff: (TODO: acquire detailed protocol description)
- interface 0 ("A"): index 1, epin 0x02, epout 0x81

View File

@ -6,6 +6,7 @@
#include <hardware/pwm.h>
#include <hardware/structs/bus_ctrl.h>
#include <hardware/sync.h>
#include <hardware/vreg.h>
#include <pico/binary_info.h>
#include <pico/platform.h>
#include <pico/stdlib.h>
@ -336,6 +337,10 @@ void sump_hw_init(void) {
}
void sump_hw_stop(void) {
// TODO: make this configurable
vreg_set_voltage(VREG_VOLTAGE_1_15);
set_sys_clock_khz(200000, true);
// IRQ and PIO fast stop
irq_set_enabled(SAMPLING_DMA_IRQ, false);
pio_sm_set_enabled(SAMPLING_PIO, SAMPLING_PIO_SM, false);
@ -355,6 +360,10 @@ void sump_hw_stop(void) {
}
void sump_hw_deinit(void) {
// TODO: make this configurable
set_sys_clock_khz(133333, false);
vreg_set_voltage(VREG_VOLTAGE_DEFAULT);
sump_hw_stop();
sump_dma_set_irq_channel_mask_enabled(SUMP_DMA_MASK, false);

View File

@ -9,11 +9,11 @@
#define SAMPLING_BITS (SAMPLING_GPIO_LAST-SAMPLING_GPIO_FIRST+1)
#define SAMPLING_BYTES ((SAMPLING_BITS+7)/8)
#if PICO_NO_FLASH
#define SUMP_MEMORY_SIZE 151552/*102400*/ // 150kB
#else
#define SUMP_MEMORY_SIZE 204800 // 200kB
#endif
//#if PICO_NO_FLASH
//#define SUMP_MEMORY_SIZE 151552/*102400*/ // 150kB
//#else
//#define SUMP_MEMORY_SIZE 204800 // 200kB
//#endif
#define SUMP_MAX_CHUNK_SIZE 4096
#endif

View File

@ -44,13 +44,14 @@
#error "Correct sampling width (8 or 16 bits)"
#endif
#if (SUMP_MEMORY_SIZE % SUMP_MAX_CHUNK_SIZE) != 0
// TODO: runtime errors?
/*#if (SUMP_MEMORY_SIZE % SUMP_MAX_CHUNK_SIZE) != 0
#error "Invalid maximal chunk size!"
#endif
// TODO
#if (SUMP_MEMORY_SIZE / SUMP_MAX_CHUNK_SIZE) < SUMP_DMA_CHANNELS
#error "DMA buffer and DMA channels out of sync!"
#endif
#endif*/
#define SUMP_STATE_CONFIG 0
#define SUMP_STATE_INIT 1