From 3cbd61c3a7a72881d3bffc9fd9ac212ca3e2286a Mon Sep 17 00:00:00 2001 From: uvok cheetah Date: Sun, 23 Feb 2020 20:34:36 +0100 Subject: Add MSP430 SPI blogpost --- _posts/2020-02-23-msp430-spi-weirdness.md | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 _posts/2020-02-23-msp430-spi-weirdness.md diff --git a/_posts/2020-02-23-msp430-spi-weirdness.md b/_posts/2020-02-23-msp430-spi-weirdness.md new file mode 100644 index 0000000..982c962 --- /dev/null +++ b/_posts/2020-02-23-msp430-spi-weirdness.md @@ -0,0 +1,29 @@ +--- +layout: post +title: MSP430 SPI weirdness +date: 2020-02-23 20:25 +0100 +language: en +categories: [tech] +--- + +So, I've been fiddling around with my MSP430 Launchpad for a while, +with the goal to build myself an ePaper doorsign. As ePaper I used +the Waveshare ones which are controlled via SPI. + +It took a lot of fiddling around, head scratching, shouting and swearing, +and probing with a logic analyzer (Logic Shrimp, which has its own issues with +Sigrok / PulseView, or v.v., since the dump was reversed) to find out how +to configure clock phase and polarity. + +Since I also want to use an MFRC522 reader to "select" the content to display, +I took another dive into the datasheet to figure out which SPI mode I had to +select. + +Then it hit me: Texas Instruments' definition of `CPHA=0` and `CPHA=1` was +"backwards" from what I'm used to from STmicroelectronics' STM32F1. It's +also backwards from what Wikipedia says. + +For TI, `CPHA=0` means "Change on leading clock egde, capture on trailing", +while `CPHA=1` means "Capture on trailing clock edge, change on trailing". + +This is pretty annoying! -- cgit v1.2.3