stm32-rs / stm32l4xx-hal

A Hardware abstraction layer for the stm32l432xx series chips written in rust.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Question: SPI scrambled messages.

milesgranger opened this issue Β· comments

Hi there!

Preface: the world's okayest noob for embedded Rust. πŸ˜„

I have a STM32L475 on a B-L475E-IOT01A2 and attempting to interact with the ISM-43362 WIFI module.

The SPI slave interface of which, mentioned in that link is:

Clock rate: 20MHz max.
Width: 16-bit
Mode: 0
Endian: Little

When issuing my AT commands, specifically A0\r\x0A to setup a manual connection point to select the network I want the module to join, I would get the following response back:

"\n\r\n\rREOR:RU knonnwC moamdn\n\r  >"

Sweet, right? My "fix" you ask? I send the command in the same flipped format as the error message:

"0A\x0A\r"

And poof, it works!? πŸ˜†

I must be doing something spectacularly dumb. As it is right now, the buffer consists of just converting that command to &[u8] via &str.as_bytes(). Which I half expected not to work, since the SPI interface is supposed to be 16-bit. But any amount of tampering with converting that command to 16bits doesn't get any response from the module at all.

Any help is very appreciated. πŸ™


Also, once I get a basic working prototype, I'd be happy to make a PR to add to the examples of this project if you'd like.