Jump to content
  • 0

MCC172 HAT with additional 3rd party SPI interface HAT board


skycraper3

Question

Hello, I'm using 2 x MCC172 HAT currently, and want to use additional HAT for RS-485 serial communication.

So, purchased https://www.waveshare.com/wiki/2-CH_RS485_HAT this one that using NXP SC16IS752 chip.

My raspberry pi has now 3 HATs, RaspberryPi 4B + MCC172 + MCC172 + RS485 HAT.

At the first, I just activated NXP chip driver in /boot/config.txt and seems work.
But when starts MCC 172 data acquisition during tty capture, tty displayed garbage data (guess binary data from MCC172).

I searched interface specifications of MCC 172 and found from datasheet,

Quote

Raspberry Pi™ GPIO pins used GPIO 8, 9, 10, 11 (SPI interface)
ID_SD, ID_SC (ID EEPROM) GPIO 12, 13, 26, (Board address)
GPIO 5, 6, 19, 16, 20 (clock / trigger sharing, reset, IRQ)
Data interface type SPI slave device, CE0 chip select
SPI mode 1
SPI clock rate 18 MHz

SO I tried added lines on /boot/config.txt

dtoverlay=spi1-2cs,cs1_pin=17
dtoverlay=sc16is752-spi1,int_pin=24

and changed device tree overlay to CE1 chip select likes below,

/dts-v1/;
/plugin/;

/ {
	compatible = "brcm,bcm2835";

	fragment@0 {
		target = <&gpio>;
		__overlay__ {
			spi1_pins: spi1_pins {
				brcm,pins = <19 20 21>;
				brcm,function = <3>; /* alt4 */
			};

			spi1_cs_pins: spi1_cs_pins {
				brcm,pins = <17>;
				brcm,function = <1>; /* output */
			};
		};
	};

	fragment@1 {
		target = <&spi1>;
		__overlay__ {
			#address-cells = <1>;
			#size-cells = <0>;
			pinctrl-names = "default";
			pinctrl-0 = <&spi1_pins &spi1_cs_pins>;
			cs-gpios = <&gpio 17 1>;
			status = "okay";

			sc16is752: sc16is752@1 {
				compatible = "nxp,sc16is752";
				reg = <1>; /* CE1 */
				clocks = <&sc16is752_clk>;
				interrupt-parent = <&gpio>;
				interrupts = <23 2>; /* IRQ_TYPE_EDGE_FALLING */
				gpio-controller;
				#gpio-cells = <2>;
				spi-max-frequency = <4000000>;
			};
		};
	};

	fragment@2 {
		target = <&aux>;
		__overlay__ {
			status = "okay";
		};
	};

	fragment@3 {
		target-path = "/";
		__overlay__ {
			sc16is752_clk: sc16is752_spi1_0_clk {
				compatible = "fixed-clock";
				#clock-cells = <0>;
				clock-frequency = <14745600>;
			};
		};
	};

	__overrides__ {
		int_pin = <&sc16is752>,"interrupts:0";
		xtal = <&sc16is752_clk>,"clock-frequency:0";
	};
};

Unfortunately, I got error, below is dmesg results,

Quote

spi-bcm2835aux fe215080.spi: cs1 >= max 1
spi_master spi1: spi_device register error /soc/spi@7e215080/sc16is752@1
spi_master spi1: Failed to create SPI device for /soc/spi@7e215080/sc16is752@1
spi-bcm2835aux fe215080.spi: cs1 >= max 1
spi_master spi1: spi_device register error /soc/spi@7e215080/spidev@1
spi_master spi1: Failed to create SPI device for /soc/spi@7e215080/spidev@1

I'm not good at kernel, message seems raspberrypi-side problem, but I cannot find MCC172 overlay in boot folder.
Also hard to find reference on web, can I get any help?

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

Hello @skycraper3,

I asked one of our MCC Hat design Engineers to review this.  His response:

"I looked at the schematic for that device, and it has hardware conflicts with the MCC 172 on GPIO26 (HAT address), GPIO19 (shared clock), GPIO16 (reset), and GPIO20 (IRQ).  It is not possible for them to use the 3rd party hat with the MCC 172."

Sorry for the bad news.

Regards,

Jeffrey.

Link to comment
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
×
×
  • Create New...