SPI pullups, INT pin question

dmaxben
Posts: 108
Joined: Thu Nov 16, 2017 6:04 pm

SPI pullups, INT pin question

Postby dmaxben » Fri Nov 17, 2017 3:54 pm

Hi everyone...

Im designing a custom PCB using the ESP32-WROOM-32.

I did some searching but couldnt find the answer I was looking for regarding the IO-MUX. I read the datasheet and the IO-MUX wasnt 100% clear on a couple things.

This will be using the ESP32 interfaced to an MCP2515 CAN transceiver using SPI. My project needs two CAN busses, so Ill be using the ESP32's internal CAN controller for CAN-1, and using an MCP2515 for CAN-2.

Here is how I have pins mapped on my PCB design:

MCP-2515.........ESP32
MISO..............IO 12
MOSI..............IO 13
SCK................IO 14
INT................IO 15
CS.................IO 27

The MISO, MOSI, SCK pins Im pretty sure are correct, as they look to be the appropriate hardware SPI pins.

The Chip-Select pin, from what I have read, can be re-assigned to any GPIO (default is GPIO 15, but this doesnt work for my PCB design, so Ill need to use GPIO 27)

The SPI interrupt pin, will that work on any GPIO? Ill be using GPIO 15. I wasnt sure if using hardware SPI required the INT to be a certain pin.

My final question.....are any pullup resistors needed on the SPI pins? Some people say its a good idea to have a pullup on the CS pin, but I have used the MCP2515 with Arduino 8-bit AVR's and it worked fine with no pullups. I wasnt sure if the ESP32 was different.

Something like this:

Code: Select all

 SPI.begin(14, 12, 13, 27); // sck, miso, mosi, ss (ss can be any GPIO)
  pinMode(27, OUTPUT);
digitalWrite(27, HIGH);
The MCP2515 runs at a maximum of 10 MHz SPI....im sure the ESP32 can make full use of that?

Thanks

ESP_Sprite
Posts: 9764
Joined: Thu Nov 26, 2015 4:08 am

Re: SPI pullups, INT pin question

Postby ESP_Sprite » Sat Nov 18, 2017 1:29 pm

Not sure about how Arduino controls SPI, but from a hardware PoV you're fine. First of all, INT isn't a pin that's defined in any SPI specs, so you should be able to route this to any GPIO pin you wish. Wrt pull-ups and pull-downs: it depends. The SPI hardware in the ESP32 doesn't normally let its lines float, so no pull-ups are needed there. Your CAN-chip probably does float its MISO line when it's not selected, however, so for extra cleanliness you may want to either enable an internal pull-up on that line or add an external pull-up. (Or pull-down; the idea is that the voltage on the line is defined when it's not in use and not flapping around in the breeze.)

dmaxben
Posts: 108
Joined: Thu Nov 16, 2017 6:04 pm

Re: SPI pullups, INT pin question

Postby dmaxben » Sun Nov 19, 2017 6:13 pm

ESP_Sprite wrote:Not sure about how Arduino controls SPI, but from a hardware PoV you're fine. First of all, INT isn't a pin that's defined in any SPI specs, so you should be able to route this to any GPIO pin you wish. Wrt pull-ups and pull-downs: it depends. The SPI hardware in the ESP32 doesn't normally let its lines float, so no pull-ups are needed there. Your CAN-chip probably does float its MISO line when it's not selected, however, so for extra cleanliness you may want to either enable an internal pull-up on that line or add an external pull-up. (Or pull-down; the idea is that the voltage on the line is defined when it's not in use and not flapping around in the breeze.)
Ok great thanks!

I just needed confirmation that my hardware layout/pin config is acceptable so I dont need to redesign the PCB.

I was just a little confused reading the GPIO-mux chart in the ESP32's datasheet.

Thanks for the advice on the pullups too. I believe the CAN chip does tri-state its MISO output when not in use...

Chidananda
Posts: 1
Joined: Wed Jan 12, 2022 6:06 pm

Re: SPI pullups, INT pin question

Postby Chidananda » Wed Jan 12, 2022 7:27 pm

Hey can anyone help me interfacing esp32 with mcp2515 with tja1050 transceiver module.

dmaxben
Posts: 108
Joined: Thu Nov 16, 2017 6:04 pm

Re: SPI pullups, INT pin question

Postby dmaxben » Thu Jan 13, 2022 2:41 pm

Chidananda wrote:
Wed Jan 12, 2022 7:27 pm
Hey can anyone help me interfacing esp32 with mcp2515 with tja1050 transceiver module.
If you are only working with one CAN bus, you dont need an MCP2515. The ESP32 already has one CAN controller built in.

All you need is the TJA1050 wired directly to the ESP32. Search "TWAI" in the ESP IDF documentation to learn about how to use the built in CAN peripheral in the ESP32.

The only situation where you'd need to use an MCP2515 is if you need to communicate on more than one CAN bus at once....in which case you'd use the ESP32's built in CAN controller for bus-1 and use the MCP2515 for bus-2.

Who is online

Users browsing this forum: Baidu [Spider] and 142 guests