From 2a3d3624be53a3d172465829ea92c824825ea120 Mon Sep 17 00:00:00 2001 From: Kevin Redon Date: Sun, 18 Dec 2011 08:35:20 +0100 Subject: Make sure we don't forward power _and_ supply SIM power at the same time The FPF2005 has no reverse voltage blocker, this is why the 3.3V from the LDO flows back into VCC_PHONE. It even damages the chip (so says the datasheet) I corrected the double power source problem by disabling the LDO (see patch), but still 1.8V does not work and 3.0-3.3V is used. I have to look for other reasons. --- firmware/src/simtrace.h | 11 ++++++++++- firmware/src/simtrace/main_simtrace.c | 10 ++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/firmware/src/simtrace.h b/firmware/src/simtrace.h index 40ed3ab..b6d44c4 100644 --- a/firmware/src/simtrace.h +++ b/firmware/src/simtrace.h @@ -30,8 +30,17 @@ #define SIMTRACE_PIO_SC_SW AT91C_PIO_PA20 #define SIMTRACE_PIO_IO_SW AT91C_PIO_PA19 +/* to set power for VCC_SIM for early prototype + * unused pin in v1.0p + */ #define SIMTRACE_PIO_VCC_SIM AT91C_PIO_PA5 -#define SIMTRACE_PIO_VCC_PHONE AT91C_PIO_PA30 + +/* to set power source for VCC_SIM for v1.0(p) */ +#define SIMTRACE_PIO_SIM_PWREN AT91C_PIO_PA5 +#define SIMTRACE_PIO_SIM_PWRFWD AT91C_PIO_PA26 + +/* VCC_PHONE detection */ +#define SIMTRACE_PIO_VCC_PHONE AT91C_PIO_PA25 /* SPI flash */ #define PIO_SPIF_nWP AT91C_PIO_PA15 diff --git a/firmware/src/simtrace/main_simtrace.c b/firmware/src/simtrace/main_simtrace.c index f919690..733f060 100644 --- a/firmware/src/simtrace/main_simtrace.c +++ b/firmware/src/simtrace/main_simtrace.c @@ -65,8 +65,18 @@ static void simtrace_set_mode(enum simtrace_md mode) /* switch VCC_SIM pin into output mode, as in the first * generation prototype we use it directly to supply Vcc * to the SIM */ + + /* pin unused in v1.0(p) and v1.1p */ AT91F_PIO_CfgOutput(AT91C_BASE_PIOA, SIMTRACE_PIO_VCC_SIM); AT91F_PIO_SetOutput(AT91C_BASE_PIOA, SIMTRACE_PIO_VCC_SIM); + /* for v1.0(p) and v1.1p, VCC_SIM can either be powered by + * VCC_PHONE using SIM_PWRFWD, or by the LDO using + * SIM_PWREN. they should be set exclusive. per default + * use VCC_PHONE */ + AT91F_PIO_CfgOutput(AT91C_BASE_PIOA, SIMTRACE_PIO_SIM_PWRFWD); + AT91F_PIO_SetOutput(AT91C_BASE_PIOA, SIMTRACE_PIO_SIM_PWRFWD); + AT91F_PIO_CfgOutput(AT91C_BASE_PIOA, SIMTRACE_PIO_SIM_PWREN); + AT91F_PIO_ClearOutput(AT91C_BASE_PIOA, SIMTRACE_PIO_SIM_PWREN); /* switch UART0 pins to 'ISO7816 card mode' */ AT91F_PIO_CfgInput(AT91C_BASE_PIOA, UART0_PINS); -- cgit v1.2.3