B402 and SC16IS760 compatibility

I have posted an issue here, but I am doubting it is a library issue. I will copy the contents here.

Problem: I am receiving a constant HIGH signal on the MISO line of the SC16IS760 regardless of input on the RX line of the SC16IS760.

Setting:

  • B402
  • SPI1 (D2 = SCLK; D3 = MOSI; D4 = MISO; D5 = Reset; D6 = CS)
  • 14.7456 MHz oscillator
  • SPI1 is dedicated to only the SC16IS760 chip.

On a previous revision of the board I was able to use I2C successfully with the '740 chip. We have switched to SPI on the '760 to try to achieve a baud rate of 921600.

I want to rule out that this is not a library issue, however the hardware seems correct. Has anyone had success using the '760 chip with SPI so far? I’ve spent a couple days looking for solutions, or if other people have come across this issue, but have found nothing.

So far I have attempted: resetting the SC16IS760 upon B402 boot, trying multiple baud rates, hard-coding the 14.7456 MHz frequency into the library (int oscillatorHz = 14745600), changing the uint8_t spiClockSpeedMHz value, and some other things.

Schematic reference:

Are you able to read registers using the readRegister() command? Just print out a few and see if they’re coming back something other than 0xff.

What does your SC16IS740SPI constructor line look like?

Have you ever enabled Ethernet? If so, that will conflict with SPI1. This will turn it off:

System.disableFeature(FEATURE_ETHERNET_DETECTION);

Hi Rick, big fan, thank you for the reply!

  1. Unfortunately I am unable to read any registers it appears. Here are a few of the registers I just checked:
uint8_t a = extSerial.readRegister(0x01);
Log.info("IER register: %d", a);

Using lines like the above two in loop, the values read from each of these four registers is 0xff:

0000010002 [app] INFO: IER register: 255
0000010002 [app] INFO: IIR register: 255
0000010003 [app] INFO: LCR register: 255
0000010003 [app] INFO: MCR register: 255
  1. Constructor line: SC16IS740SPI extSerial(SPI1, D6);
  2. I have never enabled ethernet but I have added this line in setup for further testing. Adding it alone did not immediately solve the issue.

I tested it with the B Series SoM B402 and the evaluation board with this source code and the library is working for me on SPI1 with your pin definitions.

#include "SC16IS740RK.h"

// Pick a debug level from one of these two:
// SerialLogHandler logHandler;
SerialLogHandler logHandler(LOG_LEVEL_TRACE);

// Pin  SC16IS740  Eval Board
// D2   SCK        RTS
// D3   MOSI (DI)  CTS
// D4   MISO (DO)  PWM0
// D5   /RESET     PWM1
// D6   /CS        PWM2
// Connect TX and RX on the SC16IS740 together (loopback)
SC16IS740SPI extSerial(SPI1, D6);

char out = ' ';

void setup()
{
	System.disableFeature(FEATURE_ETHERNET_DETECTION);

	waitFor(Serial.isConnected, 10000);
	delay(2000);

	pinMode(OUTPUT, D5);
	digitalWrite(D5, HIGH);

	extSerial.begin(9600);

	Log.info("reg0=0x%02x", extSerial.readRegister(0));
	Log.info("reg1=0x%02x", extSerial.readRegister(1));
}

void loop()
{
	while (extSerial.available())
	{
		int c = extSerial.read();
		Log.info("received %d", c);
	}

	extSerial.print(out);
	if (++out >= 127)
	{
		out = ' ';
	}
	delay(100);
}

USB serial output:

0000073564 [app] INFO: reg0=0x00
0000073564 [app] INFO: reg1=0x00
...
0000198056 [app] INFO: received 32
0000198157 [app] INFO: received 33
0000198258 [app] INFO: received 34
0000198359 [app] INFO: received 35
0000198460 [app] INFO: received 36
0000198561 [app] INFO: received 37
0000198662 [app] INFO: received 38
0000198763 [app] INFO: received 39
0000198864 [app] INFO: received 40
0000198965 [app] INFO: received 41

Thanks for testing that. Could you share what device OS version you are using? Also just to be sure, this is with the SC16IS740, rather than the '760, correct? I just copy/pasted your code and am still only receiving 0xff.

I can’t think of any differences between the 740 and 760 that would cause this to happen. The data sheet says they are functionally the same.

Thank you again for you help.

Yes, I used a SC16IS740 but it should be the same as as the SC16IS760, especially just for reading the registers after initialization.

Device OS 2.0.1, but it shouldn’t make a difference.

Make sure the /RESET line is going HIGH otherwise the SC16IS7xx will stay in reset and respond to every register read with 0xff.

I am able to read that /RESET is indeed HIGH (can also read LOW if I set it) using a multimeter on some of the PCB vias.

Turns out to have been the MOSI / SCLK pins swapped on our PCB, so the SC16IS760 never received any input. Thank you for the help!

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.