Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sparkfun SC16IS750 does not work on Raspberry Pi

I'm connecting a SC16IS750 spi-2-uart bridge to the Raspberry Pi 2 in order to increase the number of uart ports. The product is a breakout board made by Sparkfun (https://www.sparkfun.com/products/9981), utilizing the SC16IS750 chip (http://www.nxp.com/documents/data_sheet/SC16IS740_750_760.pdf). I use the BCM2835 library by Mike McCauley to access SPI.

The problem is, whichever register I try to read, I invariably get back 0xff. For example,

uint8_t tx[2];
tx[0] = 0x07 << 3 | 0x80;  // SPR register
tx[1] = 0x00;
uint8_t rx[2] = {0x00, 0x00};

// perform duplex write operation
bcm2835_spi_transfernb(tx, rx, 2);

rx[0] and rx[1] returns 0xff. It doesn't matter which register I try to read, the result is the same.

The breakout board already grounds the reset pin. I connect the CS pin to SSEL1, CLK to GPIO11, SI to GPIO10, SO to GPIO9, and SPI/I2C to ground. I tried with another chip, same response. SPI works fine since I also use it successfully with another peripheral.

Any idea on what I should try next?

like image 345
JZYL Avatar asked Nov 09 '22 11:11

JZYL


1 Answers

Turns out the problem is the clock divider. Setting the SPI clock divider to 256 and above

bcm2835_spi_setClockDivider(BCM2835_SPI_CLOCK_DIVIDER_256)

resolved the problem.

like image 103
JZYL Avatar answered Nov 14 '22 21:11

JZYL