Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
7 years, 9 months ago.
SPI
I have a 746 discovery board and I'm trying to use SPI. I can assign pins using the general SPI library provided by mbed but my clock appears to be bleeding into my MOSI and MISO pins. I'll take pictures of my oscilloscope and post them later but was hoping there was some configuration that I'm not utilizing correctly for this board or if I'm maybe just using the arduino based pins incorrectly.
include the mbed library with this snippet
#include "mbed.h" DigitalOut out(D10); DigitalOut led(LED1); SPI device(D11, D12, D13); //void spi_init ( spi_t * busExp,D11,D12,D13); //mosi, miso, sclk, ssel int main() { printf("start test \r\n"); int i = 0; while(1) { out = 1; device.format(8,0); out = 0; device.write(0x40); device.write(0x00); // device.write(0xE0); wait_us(25); printf("testing %d\r\n",i); wait_us(25); } }
Question relating to:
2 Answers
7 years, 9 months ago.
It should be overruled by the subsequent declaration of SPI on (D11, D12, D13), but notice that the DigitalOut on LED1 pin is actually the same physical portpin (PI_1) as the SPI2 SCK on D13.
7 years, 9 months ago.
Hello,
Refer to this manual about SPI confirguration:
- RM0385 (section 32.9.10 SPI/I2S register map) http://www.st.com/content/ccc/resource/technical/document/reference_manual/c5/cf/ef/52/c0/f1/4b/fa/DM00124865.pdf/files/DM00124865.pdf/jcr:content/translations/en.DM00124865.pdf