Hi,
I'm programming a KL03. My code has PWM, UART and a couple of interrupts. It is up and running and it only absorbs 2-3mA.
When I configure the SPI the absorbed current jumps to 75-80mA. Is this normal? Can I somehow reduce it? Even configuring and deconfiguring the SPI interface would be an acceptable solution since I use it rarely.
This is my config, just regular SPI:
#define INITIALISE_SPI_SD_INTERFACE() POWER_UP(4, SIM_SCGC4_SPI0); \
_CONFIG_PERIPHERAL(B, 0, PB_0_SPI0_SCK); \
_CONFIG_PERIPHERAL(A, 7, (PA_7_SPI0_MOSI | PORT_SRE_FAST | PORT_DSE_HIGH)); \
_CONFIG_PERIPHERAL(A, 6, (PA_6_SPI0_MISO | PORT_PS_UP_ENABLE)); \
_CONFIG_DRIVE_PORT_OUTPUT_VALUE(A, SPI_CS1, SPI_CS1, (PORT_SRE_FAST | PORT_DSE_HIGH));\
_CONFIG_DRIVE_PORT_OUTPUT_VALUE(A, SPI_CS2, SPI_CS2, (PORT_SRE_FAST | PORT_DSE_HIGH));\
SPI0_C1 = (SPI_C1_CPHA | SPI_C1_CPOL | SPI_C1_MSTR | SPI_C1_SPE); \
SPI0_BR = (SPI_BR_SPPR_PRE_4 | SPI_BR_SPR_DIV_2); \
(void)SPI0_S; (void)SPI0_D;
I tried POWER_UP(4, SIM_SCGC4_SPI0) and POWER_DOWN(4, SIM_SCGC4_SPI0) and that reduces the current to half. How can I deconfigure the other peripherals _CONFIG_PERIPHERAL and _CONFIG_DRIVE_PORT_OUTPUT_VALUE?