From 1ac00c56ea9460ac5b471eb10cfa255fd42d6633 Mon Sep 17 00:00:00 2001 From: "Ben V. Brown" Date: Sun, 20 Nov 2022 18:43:36 +1100 Subject: [PATCH] Raise up clock rate with deglitch enabled --- source/Core/BSP/Pinecilv2/Setup.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/source/Core/BSP/Pinecilv2/Setup.cpp b/source/Core/BSP/Pinecilv2/Setup.cpp index adfbc1c9..d221f8ef 100644 --- a/source/Core/BSP/Pinecilv2/Setup.cpp +++ b/source/Core/BSP/Pinecilv2/Setup.cpp @@ -37,7 +37,11 @@ void hardware_init() { setup_timer_scheduler(); setup_adc(); setup_pwm(); - I2C_ClockSet(I2C0_ID, 100000); // Sets clock to around 175kHz + I2C_SetSclSync(I2C0_ID,1); + I2C_SetDeglitchCount(I2C0_ID,1); // Turn on de-glitch + //Note on I2C clock rate @ 100Khz the screen update == 20ms which is too long for USB-PD to work + //200kHz and above works + I2C_ClockSet(I2C0_ID, 300000); // Sets clock to around 25 kHz less than set here TIMER_SetCompValue(TIMER_CH0, TIMER_COMP_ID_1, 0); } void setup_pwm(void) {