Esp8266 With Shakti : Pinaka Processor
by YatharthA1 in Circuits > Electronics
350 Views, 0 Favorites, 0 Comments
Esp8266 With Shakti : Pinaka Processor


Shakti Microprocessor is an Open-Source Processor development initiative by the RISE group at IIT Madras, sponsored by MeitY.
Being a part of the Swadeshi Microprocessor challenge and getting the opportunity to work with a shakti: pinaka processor has been quite a journey in the past month.
The major challenge I had to face was the lack of many tutorials available for a hobbyist to venture into what could possibly the future on indigenous micro controllers and so if this article helps anyone out that would be great.
This is a small article containing all that I have learnt in the past month to interface a simple 4x4 led matrix and esp8266 with a pinaka processor.
Platform IO

So first step was to get any code onto the processor the three options available are
1) Shakti sdk on the terminal - I found this quite cumbersome to setup but once done it offers the best features.
2) Arduino IDE : From most of the topics on the forums my gut feeling suggested this wouldn't be a great idea.
3) PlatformIO: balance of option 1 and 2 but only downside being you can only upload the code onto the RAM at the moment and not the flash memory. ie you have to re upload the code everytime u power it off.
Options 2&3 are available for windows but I failed to get PlatformIO running on windows as i could not get the drivers to interface properly.
- The shakti blog is a great step to get started in setting up PlatformIO (it can be found here)
now these are a few steps that I figured out on my own and I dont really know if they are intended to be this way
- every time the board is plugged in in the terminal I have to give permissions by using
sudo chmod a+rw /dev/ttyUSB1 - For seeing the output on the monitor the order of actions I followed were.
build > upload > monitor> Run without debugging >monitor
Thats about setting PlatformIO now onto the coding!!
Understanding GPIO - 4x4 Matrix

Here is my code for the 4x4 matrix
GPIO 2-5 are used for the cathodes
GPIO 7-10 are used for anodes
It helps in understanding how the GPIOs in a Pinaka processor work.
Note: I did not spend much time to actually use the matrix to its full potential and the moment u can only set one led to glow at a time.
The 2 major things to keep in mind are
1) write_word(GPIO_DIRECTION_CNTRL_REG, 0x00000FFF); is a 32 bit register that sets each of the 32 GPIOSs as a input or output.
2) write_word(GPIO_DATA_REG,led_word); is a 32 bit register that writes data to each register in case of output and reads data in case of input.
ESP8266


Connecting your micro controller to a WiFi module can open up a lot of possibilities such as IOT applications ,home automation , sending data over the WiFi.
The ESP8266 is a cheap and reliable solution to achieve the same.The major challenge in interfacing the ESP8266 was most tutorials online use the blynk app or the library , but with overcoming these challenges makes me truly understand how the ESP8266 works.
- The esp is interfaced using the UART inteface available on pins 0 and 1.
- by sending strings which are termed as AT commands we can configure and control the esp.
- the list of at commands can be found here
The connections for the board are as follows
esp8266-shakti
vcc - 3.3v
Gnd - Gnd
ch_en - 3.3v
Tx - Rx GPIO-0
Rx - Tx GPIO-1
Understanding the Pinmux Design and Data Processing...............

This is a crucial step when interfacing multiple types of peripherals.
few PINS on the board serve multiple purposes and its important for the micro controller to know what we will be using them as.
The pin mux mapping can be found in the user manual.
*pinmux_config_reg = 0x5; sets the binary value 0101 which allows the GPIO 0 AND GPIO 1 to be used as UART-1 Pins
- the data sent by the web page can be seen by seeing the network tab under inspect on a web page
- this is the format it is received by the ESP8266 and needs to be processed to extract meaningful data
Bringing It Together.


Now that most of the basic parts are ready its about adapting the code to your need.
my code can be found here
Note: one issue I faced was at times the code crashes after sending the "AT+CIPSERVER=1,80" in that case you have to restart the code.If anyone finds a solution please mention it in the comments!!!
Conclusions
Thanks for making it this far. This is my first Instructable and i feel its more of a blog where I have put out what I have learnt rather than giving instructions.
I hope You have found it useful and helps you in anyway and would love to hear your suggestions below
Feel free to reach out at Twitter
or mail me at yatharthrpi@gmail.com