summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexandru M Stan <amstan@chromium.org>2014-09-16 12:31:40 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-09-23 22:24:42 +0000
commit4afee85638257d71600e8ad8c74f0a2d7b35ad0c (patch)
tree9e66a9979c03cd1c832b78fcab0f8fa9552ed934
parent45abc9fa62fb8fe015d27c3e27c8fdddd351e338 (diff)
downloadchrome-ec-stabilize-6297.B.tar.gz
stm32/spi: Print packet on bad datastabilize-6297.B
Just after a bad data error the EC will print the packet(pretty much the whole thing): in_msg=[02 00 0f 03 f4 09 00 00 ] I found it very helpful when debugging SPI TX/RX to know what the EC sees. BUG=chrome-os-partner:31390 TEST=Load spidev and send the EC bytes manually(malformed packets) BRANCH=None Change-Id: I037ab909076dc454379040e2e927dc6a0b5c5ea9 Signed-off-by: Alexandru M Stan <amstan@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/218442 Reviewed-by: Alec Berg <alecaberg@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
-rw-r--r--chip/stm32/spi.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/chip/stm32/spi.c b/chip/stm32/spi.c
index 2b62a977c0..ccae485e7b 100644
--- a/chip/stm32/spi.c
+++ b/chip/stm32/spi.c
@@ -22,6 +22,7 @@
/* Console output macros */
#define CPUTS(outstr) cputs(CC_SPI, outstr)
#define CPRINTS(format, args...) cprints(CC_SPI, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_SPI, format, ## args)
/* DMA channel option */
static const struct dma_option dma_tx_option = {
@@ -429,6 +430,7 @@ void spi_event(enum gpio_signal signal)
stm32_dma_chan_t *rxdma;
uint16_t *nss_reg;
uint32_t nss_mask;
+ uint16_t i;
/* If not enabled, ignore glitches on NSS */
if (!enabled)
@@ -570,6 +572,11 @@ void spi_event(enum gpio_signal signal)
tx_status(EC_SPI_RX_BAD_DATA);
state = SPI_STATE_RX_BAD;
CPRINTS("SPI rx bad data");
+
+ CPRINTF("in_msg=[");
+ for (i = 0; i < dma_bytes_done(rxdma, sizeof(in_msg)); i++)
+ CPRINTF("%02x ", in_msg[i]);
+ CPRINTF("]\n");
}
static void spi_chipset_startup(void)