Errors due to incorrect pin direction (tri-state/output)


I’m designing a board that has multiple MAX31856 connected to the same SPI bus, but the SDO pin is set to output and this generates errors during DRC.

I know that the circuit is correct, but don’t bother correcting the part and saving it specific to that project.

My question is:

Is there something softwarewise that would hinder the board from working correct as a result of these errors, even though I can see that the circuit is correct?

My crystal bal is a bit foggy and without schematic I can not see how you connected things. Neither am I familiar with your MAX… . Usually the SDO is connected to te SDI of the next chip.

I also think you are mixing up DRC with ERC.
Design rule check is in Pcbnew, and handles track widths, clearances between tracks and that sort of thing. Electrical rule check is in Eeschema and has to do Input and output pins etc.

I had a very short peek at:
but I did not see an example of connecting multiple of these things.

Another thing to consider are bit faults on your microcontroller or simply faulty written software. I never like the idea of hardware letting out the magic smoke and getting damaged because of a silly software mistake. Putting an extra 0.2ct serie resistor is often enough to even be safe in such situations.

Edit / Addition:
According to the datasheet SDO is not (always) an output but has High-Z properties, which makes it more like an Tri-State pin.
I assume (but that’s a lot of assumptions combined with above) that you want to connect multipe SDO’s together and trust on the adressing to keep short circuits from happening. This probably works as long as everything goes as planned (how does your MAX chip get it’s adress?), but still, I have no idea how robust these chips are and the series resistor from preventing shorts from being catastrophic is a small price to pay.

Hi Paul,

I know it to be working, because I have previously designed it this way with success. But back then I changed the SDO pin to tri-state and made a custom part for that project.

It’s just a bunch of SPI chips connected together and all docs I have found says to connect all MISOs together and all MISOs together.

Yes, taht is my point, the kicad included library for this part is incorrectly labeled and has been for some time.

There is no address, it is a chip select chip on an SPI bus.

Here’s the circuit

I did not look too close at A0… A6, they may be adress bits for internal registers.
Your schematic is not complete. If your rely for example on a 74HC138 to generate ~CS and to ensure that never more than one of your MAX… IC’s can be active at the same time it’s also pretty safe. Usually chips do not die (immediately) if a short is created between output pins. But still. Putting in some series resistors costs almost nothing.
You could do a test by enabling SDO on a few chips and see if they survive and how hot they get. The SPI bus is usually also used with a low duty cycle, which makes short circuits even less severe.

But in the end it’s upto you how reliable you want your circuit to be.

And another thing:
Your thermometers are upside down.
I usually draw my schematics with signals from left to right, and voltages from top to bottom, which makes schematics easier to read and mistakes of connecting power supply voltages less likely.

Your chip is also a 3V3 chip with an absolute maximum rating of 4V for power. Are you sure you want to put 5V on that? I noticed that because I found your value of 10uF for decoupling caps unusual, and sure enough, the datasheet recommends the more common 100nF. Bigger is not better here.

I usually gather all the decoupling caps near the power supply, so they do not clutter the rest of the schematic, for example like:

Me again.
Just noticed that in the datasheet both power supply pins have a separate decoupling capacitor. This is pretty common for mixed analog / digital parts, and those pins should be handled with some care and not simply tied together on the PCB.

Hi Paul, thank you for the valuable input.
I will implement your suggestions into the design.

Yes. The electrical rules check list can be modifid by the user.

There is a tab “Options” in the ERC window. You can modify the output-pin to output-pin message from error to “warning” or “green”.

But be careful, since it will not warn you about an undesired output-pin connected to output-pin issue.

The ERC checker has no influence in the circuit. Errors and warnings can be ignored if you know what you are doing.

A different issue is the layout DRC. Errors can’t be ignored in the layout or the pcb will go directly to the dustbin.

Disclaimer i did not fully read everything here. My answer might already be included above.

The error reported would only mean that your schematic is incorrect if the pin types assigned where correct.
SDO typically is a tristate not a output and the chip select pin defines which component is allowed to use the SDO pin as an output. This means you can connect many spi slaves to the same SDO line as long as you never have two devices with chip select active at the same time. In this case the selection of pin type “output” is wrong.
If your device does not come with chip select or you have chip select always active then output would be correct and the error message would really mean that your circuit can not work.

Thank you for your replies.
I would like to power the MCU with 5V in order to run at 16MHz.
To acomplish this I need a level converter on the SPI bus.
Can you recommend a method or IC?

I have used BSS138 MOSFETs for the uart, but I’m unsure if that is fast enough for SPI bus?

This is my SPI level converter circuit

And for the TC ICs

There are single chip ICs that can be used for level conversion. Example (A chip i used to translate 3v3 spi to 5v spi): MAX3390EEUD

Or if you need isolation you can use something like ISO7241.

The problem with those BSS138 tranistors is not the speed of the transistors, but the speed of the passive pullup resistors, in combination with wire capacitance.

But why use voltage converters at all?
Almost all microcontrollers run very happily at 3V3, and a lot even run from as low as 2V. (Very nice for 2AA batteries).

I’ve seen batery powered “arduino’s” that crank up the battery voltage with a small smps to 7V or so to power the “arduino” board, and it makes my eyes water.
If you’re designing a PCB, then why not put your microcontroller also directly on the PCB, and use the same supply voltage for everything?

Hi, sorry for not replying earlier.
The board is a temp logger board that combines an ATMega328 with an RPi and I would like to run the ATMega at 16 MHz, so I need 5V and therefore also level conversion.

I used 4.3k pullup resistors in the hope of it providing more “pullup-power” than a pair of 10k.

I looked at the MAX series of level converters, but decided to use the BSS138 for simplicity, because is I read the datasheet correct I need to toggle a direction pin to send/receive.

I can post the schematic in the morning, I would like some feedback to see if there’s something that can be done better.

That datasheet is for a lot of different chips. The one i used for spi really does not need any additional things other than the spi connections themselfes. (Full order number is given above) I however also used cs to enable and disable the output side to save power.

And to be honest i am the opposite. I find a black box chip with a simple interface much easier to use than even the simplest transistor circuit simply because i am not really into analog design and therefore never bothered to learn how transistors behave in anything else then the typical switching configurations.

But… but… that is a switching configuration, just with the twist of internal diode doing something useful for once :slight_smile:

From anyone unfamiliar with the BSS138 connection.
It is rom a (pretty old) application note from when “NXP” was still Philips.
That application note was for combining I2C chips with different power voltage levels.

… And only now I see that zenseidk is using SPI instead of I2C. Oopie.

I2C always works with passive pullup resistors and the BSS138 circuit is therefore a good match. SPI however works with push pull / totem pole outputs, and bitrates can be very much higher.

This is getting into the region where you should connect your oscilloscope and start poking around to verify signal integrity…

I also do not see any need to run an AVR at 16MHz for a bit of temperature logging.
You have both the raspi, and your temperature chips running at 3V3 (or lower maybe for the raspi itself). Putting an AVR @5V & 16MHz is … at least a bit weird. Simply use it at a lower clock rate, which will still be plenty fast, or use some ARM processor @ 3V3 & 70MHz or more if you want “speed”.

I’m not sure, but I think the Raspi itself also has some SPI channels, Why add an extra uC at all?

I want to be able to use the board as standalone as well, so I added an AVR.
@paulvdh yes, you are right, the bss138 was used for I2C, so I was hoping it can be used for SPI as well, but I have not found any definitive answer. About bitrates, SPI can be set to 125000 Hz at the lowest, which matches I2C reasonably well. You might be right that actually placing pullups in an SPI bus would cause issues…
Hmmmmmm… Maybe I should just use that MAX3390EEUD IC ?
The reason I prefer 16 MHz as oposed to 8 is some timing issues I’ve had in previous versions of the board.