SPI pullups, INT pin question

dmaxben
Posts: 79
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: 4034
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: 79
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...

Who is online

Users browsing this forum: Google [Bot], 腊肉larou and 47 guests