comparison src/cs/drivers/drv_app/spi/spi_env.c @ 261:841a848ba762

SPI SWE: clear any pending boot-time interrupts in spi_init() Charger plug/unplug hw logic in the Iota ABB has no built-in debouncing, thus electrical contact bounce on the charging power connection interface produces a lot of charger plug/unplug interrupts. When we boot in charging mode (charging power present at boot time and is presumably the cause of Switch-ON), some bounce may occur between the initial Iota Switch-ON action and Calypso firmware booting. By clearing any accumulated ITSTATREG interrupts on boot, we prevent these pre-boot interrupts from generating charger plug/unplug events to FCHG, which would upset smooth from-boot charging.
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 14 May 2021 02:49:05 +0000
parents 34b7059b9337
children
comparison
equal deleted inserted replaced
260:34b7059b9337 261:841a848ba762
23 #include "rvm/rvm_use_id_list.h" 23 #include "rvm/rvm_use_id_list.h"
24 #include <string.h> 24 #include <string.h>
25 25
26 //extern T_RV_RET spi_core(void); 26 //extern T_RV_RET spi_core(void);
27 #include "spi/spi_task.h" 27 #include "spi/spi_task.h"
28
29 #include "abb/abb.h" /* FreeCalypso addition for initial IT clearing */
28 30
29 31
30 /* global pointer to the error function */ 32 /* global pointer to the error function */
31 static T_RVM_RETURN (*spi_error_ft)(T_RVM_NAME swe_name, T_RVM_RETURN error_cause, 33 static T_RVM_RETURN (*spi_error_ft)(T_RVM_NAME swe_name, T_RVM_RETURN error_cause,
32 T_RVM_ERROR_TYPE error_type,T_RVM_STRING error_msg); 34 T_RVM_ERROR_TYPE error_type,T_RVM_STRING error_msg);
169 * 171 *
170 * 172 *
171 ******************************************************************************/ 173 ******************************************************************************/
172 T_RVM_RETURN spi_init(void) 174 T_RVM_RETURN spi_init(void)
173 { 175 {
176 /*
177 * FreeCalypso addition: clear any initial interrupts,
178 * particularly charger plug/unplug.
179 */
180 (void) ABB_Read_Register_on_page(PAGE0, ITSTATREG);
181
174 return RV_OK; 182 return RV_OK;
175 } 183 }
176 184
177 185
178 /****************************************************************************** 186 /******************************************************************************