KL25Z pinmap mis-match error

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

KL25Z pinmap mis-match error

351 Views
sagaraddepalli
Contributor I

I am trying to use an SPI interface to talk to 8 slaves using a KL25Z. I figured that using the same MISO pin for all the eight boards was not working out, so I used different pins. Everything was working well when suddenly today the board decided to start misbehaving. This is the relevant part of my code(or so I believe) - 

#include "mbed.h"
#include <spi_functions.h>
#include <vector>
#include <string>

void doCommands(string command[3]);
using namespace std;

// DEFINE SERIAL INTERFACE AND PINS USED BY THE SPI PROTOCOL
Serial pc(USBTX, USBRX); // tx, rx
SPI dac_port1(PTD2, PTD3, PTD1); //mosi, miso, sclk
SPI dac_port2(PTD2, PTE3, PTD1);
SPI dac_port3(PTD2, PTC7, PTD1);
SPI dac_port4(PTD2, PTC6, PTD1);//was PTD6
SPI dac_port5(PTD2, PTA17, PTD1);
SPI dac_port6(PTD2, PTD7, PTD1);
SPI dac_port7(PTD2, PTE1, PTD1);
SPI dac_port8(PTD2, PTA16, PTD1);
DigitalOut sync1(PTD5, 1);// Board 1 slave select. Initialize to high
DigitalOut sync2(PTD0, 1); // Board 2 slave select. Initialize to high
DigitalOut sync3(PTC5, 1); // Board 3 slave select. Initialize to high
DigitalOut sync4(PTB11, 1);// Board 4 slave select. Initialize to high
DigitalOut sync5(PTB10, 1); // Board 5 slave select. Initialize to high
DigitalOut sync6(PTE2, 1);// Board 6 slave select. Initialize to high
DigitalOut sync7(PTD4, 1);// Board 7 slave select. Initialize to high
DigitalOut sync8(PTC4, 1); // Board 8 slave select. Initialize to high

Can someone help in this regard?

0 Kudos
1 Reply

263 Views
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi,

I am quite curious with your select the SPI MISO pins.

I check you select the PTD2 as MOSI, which belongs to SPI0 module.

While, the PTD3/PTD7/PTE1/PTE3 as MISO function belongs to SPI1 module.

Please make sure the SPI slave doesn't be selected at the same time to output data to SPI master.


Have a great day,
Ma Hui

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos