Initialize custom pins for SPI

Deouss
Posts: 425
Joined: Tue Mar 20, 2018 11:36 am

Initialize custom pins for SPI

Postby Deouss » Sun Apr 01, 2018 2:08 pm

Let's say I want specific pins for SCK MISO MOSI etc. I see there is a esp32-hal-spi.h allowing to attach/detach that however I noticed when compiling many Arduino-stuff examples and looked at the code - I couldn't find a straightforward initialization of SPI pins. I guess it's done by default somewhere...?
I really would like to control that because I use a lot of pins and connect more than couple devices and many of them get wrong readings because there is something wrong with how pins are set up.
Are there any ESP lower level/advanced tutorials for spi, adc/dac, i2c, timer...etc ?
I would appreciate help.
thank you

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

Re: Initialize custom pins for SPI

Postby ESP_Sprite » Sun Apr 01, 2018 3:10 pm

My guess (as it mentions HAL) is that this is an Arduino question?

Deouss
Posts: 425
Joined: Tue Mar 20, 2018 11:36 am

Re: Initialize custom pins for SPI

Postby Deouss » Sun Apr 01, 2018 6:13 pm

Well I am not sure what other choices I have. I really would like to use plain non-Arduino libraries but I am just a beginner in esp programming. I don't have much choice but use Arduino framework for some time unless you can direct me to better dedicated framework - I prefer under Windows only. STM has stmCube - stuff like that would be nice for esp.
vsMicro works great but it is a bit quirky and doesn't work as full C/C++ environment. Personally, I don't think there should be some common framework for different boards because each of them is very unique and has special features

Deouss
Posts: 425
Joined: Tue Mar 20, 2018 11:36 am

Re: Initialize custom pins for SPI

Postby Deouss » Sun Apr 01, 2018 10:24 pm

So is it possible to do that? how do I attach custom pins to spi clock mosi miso and other interfaces?

WiFive
Posts: 3529
Joined: Tue Dec 01, 2015 7:35 am

Re: Initialize custom pins for SPI

Postby WiFive » Sun Apr 01, 2018 11:57 pm

https://esp32.com/viewtopic.php?f=19&t=5205

Remember there is an Arduino subforum for anything related to Arduino. This subforum is for https://github.com/espressif/esp-idf

Deouss
Posts: 425
Joined: Tue Mar 20, 2018 11:36 am

Re: Initialize custom pins for SPI

Postby Deouss » Mon Apr 02, 2018 11:31 am

I care less if I use Arduino. I just want to initialize custom pins using esspresif idf or other code
Also I have some questions about asp idf.
I assume sdk is to use with FreeRTOS and has nothing to do with Arduino esp libraries.
I don't even know how different is the architecture of those. Some people say OS is slower than bare metal.
Practically for larger projects OS is a must. I am at the stage of setting this up under Windows.
Not sure what is the best way. Will try the programming guides.

Deouss
Posts: 425
Joined: Tue Mar 20, 2018 11:36 am

Re: Initialize custom pins for SPI

Postby Deouss » Mon Apr 02, 2018 1:22 pm

This is response I received from Arduino forum
On the Arduinos, the pins are given special meaning, like SPI, I2C, etc. by the chip maker.

IF the ESP allows customizing the SPI, I2C, etc. pins, you should ask on the ESP forum how to do that.

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

Re: Initialize custom pins for SPI

Postby ESP_Sprite » Mon Apr 02, 2018 3:35 pm

Fyi Arduino also uses ESP-IDF (and thus FreeRTOS) underneath. Having an OS/RTOS is pretty much a requirement if you want to do multi-core programming with complex stuff like WiFi and BT.

WiFive
Posts: 3529
Joined: Tue Dec 01, 2015 7:35 am

Re: Initialize custom pins for SPI

Postby WiFive » Mon Apr 02, 2018 3:37 pm

Yes I said Arduino subforum aka https://esp32.com/viewforum.php?f=19

On esp32 Arduino runs on top of freertos anyway. Sounds like you have a lot of reading to do. There are lots of tutorials and examples on blogs and YouTube and GitHub.

Deouss
Posts: 425
Joined: Tue Mar 20, 2018 11:36 am

Re: Initialize custom pins for SPI

Postby Deouss » Mon Apr 02, 2018 4:17 pm

ESP_Sprite wrote:Fyi Arduino also uses ESP-IDF (and thus FreeRTOS) underneath. Having an OS/RTOS is pretty much a requirement if you want to do multi-core programming with complex stuff like WiFi and BT.
Well, then you easily should be able to help me.
Where all pin initialization is located so I could assign pins?
Do you know what header/source file I should look up?

Who is online

Users browsing this forum: tomy983 and 270 guests