SPI RAM

I am anticipating the new PCBs coming in soon, (I have a tracking number but it doesn’t show up with Hong Kong Post or USPS). In light of this, I decided to do a little research on the SPI RAM so that when it gets here, I can quickly write code to test the functionality of the design.  The SPI RAM I have chosen is a 23LC1024.  A common manufacturer of this chip is MicroChip, I downloaded their datasheet for this chip and started looking at the process to write to and read from the RAM.

Notes for writing to SPI RAM:

Maximum 20 Mhz Clock for all data transfers (might cause me to slow down the FLASH)

Write speed only limited by clock speed.

Write command(0x02) followed by 24bit address followed by data

Page Mode 32bytes before sending a new address

Sequential mode can fill the whole RAM

Write is terminated by CS going inactive(HIGH)

Notes for reading from RAM

Same maximum clock speed.

read only limited by clock speed.

Read command(0x03) followed by 24bit address start receiving/clocking data from RAM

Three modes of operation, Byte, Page, and Sequential.

Byte mode only allows reading/writing one byte before having to resend an address.

Page mode all data is accessed in pages of thirty two bytes. Not very useful for this project.

Sequential mode allows access to all of RAM as one big block that I can start accessing from any point. I need to set the mode register bits 7 and 6 to 01.

I am going to start in standard SPI mode, Make sure it is working then adjust the code to start taking advantage of the SQI interface.

Making, Hacking, and or Engineering.

I am waiting for PCBs to come in and hardware testing is next on my agenda for the design. So, I wanted to explore the differences of Making, Hacking, and Engineering.

Dictionary.com Definitions:

Making:

1. the act of a person or thing that makes:

The making of a violin requires great skill.

Hacking:

8. Informal. to make use of a tip, trick, or efficient method for doing or managing (something): to hack a classic recipe;

to hack your weekend with healthy habits.

Engineering:
1. the art or science of making practical application of the knowledge of pure sciences, as physics or chemistry, as in the construction of engines, bridges, buildings, mines, ships, and chemical plants.
I of course picked the definitions relevant to this blog. Making requires skill but doesn’t necessarily have to be clever.  Hacking as used in the term “life hack” are clever or unusual ways of doing something efficiently.  Then finally Engineering is applying known science to a given goal. As an electronics designer, you are usually working in a blend of all three ways.
A few days ago, I did a little project that was basically all Making.  I wanted an inline set of controls for a wired headset that I already own. I looked up the requirements online, designed the schematic, and PCB layout and ordered PCBs.  I really didn’t do much engineering and it wasn’t particularly clever.
When designing something that has never been done before, Engineering is great, but sometimes falls flat. Perhaps the design hasn’t been done because no one has found a clever solution yet. An engineer has to be careful when they incorporate a hack into their design.  Often clever solutions have unforeseen drawbacks that may not become apparent until thousands of units have been produced.
Sometimes a design hasn’t been done because no one has seen the need for it before.  This is often a nearly pure engineering process. Nothing in the design is hard to do, but you have to know the science(or it’s shortcuts) to complete the design.
Side note: In some cultures Engineering is about individual and public safety. An Engineer’s job is to make sure a product or design won’t hurt someone. Although I think it is important to always be thinking about safety in your design, this is not part of this discussion.
Side Note: Scientific shortcuts speed up the design process.  For instance we know the left hand rule for figuring out the magnetic polarity of a coil given it’s direction of current flow.
Do you have any favorite science shortcuts? Are you a maker, a hacker, or an engineer?  Is there another way to look at creating something that you’d like to talk about?

Hello World Firmware V0A

I have finally created a “Hello World” project that works with the Espressif IOT API.

First, in the upper right hand side of this page is a link to the GitHub repository for this project firmware. The general rule for version systems is that you only commit if the code is runnable.  I hope to break the code up into small enough chunks that I won’t get a majorly broken version in the repository, however things happen. If I get stuck, I’ll commit broken code to the repository to keep it current with these blog postings.  GitHub maintains Versions, I’ll try to name each commit in a way that ties back to the current blog entry.  The current commit is the same as the post title, “Hello World Firmware V0A”

Things happened again,  I did a security update on my OS and the esptool.py firmware uploader stopped working altogether.  I did a quick search online and found that the pyserial library started failing with this update.  So I figured out how to roll back to the previous version of the OS kernel and I could get the firmware upload to work.

I copied the AT firmware project into the app directory and ran the gen_misc.sh script file to configure the libraries.  I had some problems with this and I feel I need to know more about how the makefile works.  The gen_misc.sh (gen_misc.bat for windows users) creates a file with the needed libraries for the project.  For GitHub I ended up moving the project to the folder named UProgrammer-Firmware in the same folder that the app folder was in.

I deleted the AT firmware files from the project directory, keeping the user_config.h file in the include folder. I then created a new user_main.c file that just set up the serial port to 115200 baud and sent the text “Hello World” out the serial port from the user_init() function.  This worked and I wanted to do something a little more in depth of the API functionality.  So I started a timer that calls my code called user_state() once every second.  I set up this function to send “Hello World” over the serial connection on the second call of it.  I also removed the sending “Hello World” from the user_init() function.  The function user_init() is called once during boot up of the processor.

I also added the commands to connect to my wifi network.  I verified this by using a utility to see what devices were connected to my network.  When I saw the name espressif for one of the devices, I knew it was connected.  I took one more step and added a new file called wifi.c and a new file wifi.h to the project.  To the file wifi.c, I copied a function from the API documentation that reports connection status changes to the serial connection.  I changed which UART is used so it would report back over the serial connection.  I put the prototype for the function in wifi.h.

Finally, I created a file called simple_serial.c and another file called simple_serial.h.  I plan on moving the initialization code into simple_serial.c to clean up the user_init() function.  I also plan on creating a simple text interface for configuring the connection details.

On the hardware side, I couldn’t re-solder the connector to the board because of too much damage so I cut a USB cable and used the A connector end with wires soldered to the board. I then used super glue to form a strain relief for the wires.

Boot Hello World

USB cable connection

KiCad EDA tools

I have never used the KiCad toolset.   The schematic capture tool I am familiar with is an older version of OrCad.  The industry tools have changed a lot, I expect a steep learning curve.

KiCad is open source, and free to use.  I will be posting my schematics, layout files, and new part libraries. This allows you to edit and suggest changes/ideas along the design path.

KiCad is available on Windows, Mac, and Linux machines.


KiCad is in the Ubuntu Software Center.  This makes installing as easy as searching for “KiCad” selecting the install package, and click on install.  The software center prompts me to authenticate and I proceed with the install.  I also selected the English help file to download with the install. The version I installed is 2013-jul-07 Stable.

Ubuntu Studio places the KiCad Launcher in the Development menu folder. I ran it and got a dashboard for all the tools that come along with KiCad. This dashboard also helps manage projects.

Kicad Dashboard

There are tutorials linked to from the KiCad Website that I will be checking out this week.