• 0
Sign in to follow this  
Francisco

SPI SS pin always low on Uno32

Question

Hi, I've been trying to communicate an Uno32 board with a CC1101 transceptor based board.

I've tried the 3 SPI libraries that come with mpide: DSPI, SoftSPI and SPI. However there's always a problem, the SS pin will always stay "low".

Here are the outputs of each pin:

SCK: https://www.dropbox.com/s/5d0fo6tflt3po1z/sck_pin.jpg?dl=0

MOSI: https://www.dropbox.com/s/arc7xol235zjb06/mosi_pin.jpg?dl=0

MISO: https://www.dropbox.com/s/2cs0oxyi6jqpvn9/miso_pin.jpg?dl=0

SS: https://www.dropbox.com/s/3yg1b3xxpe8l1ec/csn_ss_pin.jpg?dl=0

The Uno32 can only be master, so the jp4 jumper has always been in the RD4 position. We've even tried specifying the SS pin, pin number 10, in the 'begin' function of each library, but all to no avail.

Any help is seriously appreciated. Thanks in advance.:)

Share this post


Link to post
Share on other sites

2 answers to this question

Recommended Posts

  • 1

Hey Francisco,

So as far as the libraries you have available, your best bet would be to use the DSPI library. With that library I believe the SS remains active low until the slave device starts receiving data. That being said though, here are a couple things that you may find helpful.

Placing the JP4 jumper in the RD4 position configures pin 10 to function as a PWM output, whereas setting the jumper to the RG9 position configures pin 10 to function as a SS input for operation as an SPI slave device (I'm not 100% convinced about this though) In any case, since that's not what you're doing here I would just avoid bothering with pin 10 all together. Instead, you could use the J8 block on the right side of the board for your connections. 

uno32spi.thumb.png.e7d353c2790a744d8797f

Here, with your SPI select jumpers (JP5 and JP7) in the Master position, your MISO will be pin 1 (brown wire), clock will be pin 3 (green wire), MOSI will be pin 4 (blue wire), and your SS will be pin 5 (yellow wire). If you have your heart set on using the in-line pins in the larger IO bank, I would imagine that with the JP4 jumper set to RG9 you should be able to use pin 10 as a slave select (not just as an SS input). I'm just basing this off of the schematic and the fact that I can't seem to find any indication as to why this pin would be for the uno32 operating exclusively in slave mode.

Hopefully you find some of the info here helpful!

Regards, 

Nate

 

Edited by NAEastland

Share this post


Link to post
Share on other sites
  • 0

Thanks for your response Mr. Nathan,

Instead, you could use the J8 block on the right side of the board for your connections.

Actually we were using the J8 block for testing. Turns out that the solution was using the J6 port instead. I still don't understand how this now works, shouldn't it work on both ports?

This is the code we're using

DSPI0    spi;
...
spi.begin();
spi.setSpeed(1000000);
spi.setMode(DSPI_MODE0);
spi.setPinSelect(10);
...
send=11110000;
spi.setSelect(LOW);
    answer = spi.transfer(send);
spi.setSelect(HIGH);
Serial.write(answer);//0
send = B11110001;
spi.setSelect(LOW);
    answer = spi.transfer(send);
spi.setSelect(HIGH);
Serial.write(answer);//20

Since the expected answers are 0 and 20 instead of the constant 15 we get I can not say the problem is fixed,but at least we now get a "proper" response. Here are the CLK and MISO signals together.

https://www.dropbox.com/s/6hc6wl0wq6k6in5/miso_clk_normal.jpg?dl=0

https://www.dropbox.com/s/pi74hvhuzk8402h/miso_clk_zoom.jpg?dl=0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this