Thursday, December 5, 2013

RF Sample Code for CC430F5137

The Variable LT FIFO RF sample code on TI for CC430F5137 works but it is difficult to be reused in another project because it is tightly coupled to the application code and causes some problem on the interrupt routine if the one who is reusing it is not careful enough.

I revised the code so that it can be reused and reduced most of the processing in the interrupt routine. Although not yet finish and still in progress, it is in usable state as of this writing.

Get it here.

Tuesday, October 29, 2013

Link Sharing: Model View Controller (MVC) Design Pattern

I am looking for good examples on MVC Design Pattern implemented in Python. I saw this site and it contains very concise and straight to the point examples.

MVC Wikipedia

Sunday, September 22, 2013

Kicad's Middle Mouse Panning

I played with KiCad before and made very small progress learning that tool because I thought there is no middle mouse panning feature. Since I am inclined to Eagle, Kicad's lack of middle mouse panning button turned me off. But I was wrong! To my surprise, Kicad has a middle mouse panning feature. However and surprisingly, it is not enabled by default (I used Windows installer).

To enable this:
- On Schematic Editor, go to Preferences > Options. Then check the Use middle mouse button to pan.
- On PCB Layout Editor, go to Preferences > General > Pan and Zoom. Then check the Use middle mouse button to pan.

In my opinion, this should be enabled by default or there should be a start-up option after the first time installation and let the user choose if they want this feature or not.

Now, I think I am ready to jump out of the Eagle bandwagon. :)

Friday, September 6, 2013

Short Review: RF Explorer, Low-Cost Handheld Spectrum Analyzer



I got this small handy tool for my current RF project (CC1101 and CC430 based). Very easy to use and can be connected to a software for capturing data, easier/faster configuration, and making data screenshots. I was able to identify and rectify firmware and hardware issues during design stage. Highly recommended!

RF Explorer Homepage

Information Sharing: Starting Firmware Development using TI's SmartRF Studio (CC1101 and CC430)

SmartRF studio is a very great tool. Although it have some minor quirks, it greatly helps in generating RF configurations for chip. My current project uses CC430 chip as the transmitter and a CC1101 based chip interfaced to K60 Arm Cortex M4 as a receiver.

If you have evaluation boards, the fastest way to test it is by choosing the right SmartRF configuration (Under typical settings) and using the "Packet TX" for the transmitter and "Packet RX" for the receiver. You should be able to see the packets sent by the transmitters.

I was also able to successfully connect Evaluation modules via SmartRF04EB, and my external MCU is controlling the EVM modules. This is very useful in prototyping stage and performance feasibility study. However, I will not be discussing it here and just focus on testing of the custom boards instead.

If you will be using your own board with CC1101, make sure you always read and check the chip ID on initialization. This will give you a high chance (but not 100%) that the CC1101 is working and soldered properly. This self-check is ideal specially if the board is mass produced.

Next, if you want to start testing the Smart RF configuration with the firmware and hardware, I think that the best and fastest way to test both the firmware and hardware is by using using Continuous TX mode on transmitter and Continuous RX mode on receiver:

On Transmitter:
1. Export configurations from SmartRF Studio using Continuous TX  (Unmodulated Signal) with the lowest power. For this example, we will be using -30dbm. (For CC430 chip, SmartRF studio doesn't have a drop down choice for the -30dbm, consult the Design Note DN013 Programming Output Power document from TI website).
2. Strobe SRES (Reset the chip)
3. Execute the settings (with the PATABLE).
4. Strobe TX.
5. Let the transmitter stay in TX mode ( while (1); ).

On Receiver:
1. Export configurations from SmartRF Studio using Continuous RX. (the receiver and transmitter must both have the same selected typical settings).
2. Strobe SRES (Reset the chip)
3. Execute the settings.
4. Strobe RX.
5. With the ambient level, read the RSSI register,then compute and check for the corresponding level in dbm.
6. With the conducted transmitter at -30dbm, read the RSSI register,then compute and check for the corresponding level in dbm. The reading should be near -30dbm)

With this, you may have an idea if the SPI connection and/or RF circuitry (balun,matching and filter circuit) is in an acceptable condition.

Monday, July 15, 2013

Trying out: Python's PyCrypto RSA Module

PyCrypto is a very good cryptographic library for python. Now, I am currently trying out PyCrypto's RSA module.

What I am currently trying to do is:
1. Alice will generate the public key and private key
2. Alice will then send the public key to Bob
3. Bob will encrypt a message using the public key that Alice sent
4. Alice will then receive the encrypted message
5. Alice will decrypt the encrypted message

Here is the source code.

Here is the output:

Alice will send this file:
-----BEGIN PUBLIC KEY-----
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCHXGhd1bPKNJHQk08inY0N9hNf
F4SQGliy9qBV8IbuQQTvqF2T3Nx3+i2J6YdzCkWC87ec4Se/2KA9R4haj6t/M5by
jsO5RVe0olJ3tYiKEEM/QzB7ybPH7rlSGMfw14MyhZT7aVq2v6Qfdz3KvS62mf86
ARJ4vYXCd7FJOZaTcwIDAQAB
-----END PUBLIC KEY-----

Bob reads the file:
-----BEGIN PUBLIC KEY-----
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCHXGhd1bPKNJHQk08inY0N9hNf
F4SQGliy9qBV8IbuQQTvqF2T3Nx3+i2J6YdzCkWC87ec4Se/2KA9R4haj6t/M5by
jsO5RVe0olJ3tYiKEEM/QzB7ybPH7rlSGMfw14MyhZT7aVq2v6Qfdz3KvS62mf86
ARJ4vYXCd7FJOZaTcwIDAQAB
-----END PUBLIC KEY-----

Alice reads the file with the encrypted message:
"'\x1f\xe3\xcfn\x8f!\x0eA\xa9e\xd4\x91\xd9Dl\x86\xfb\xf2\x1c[p!*\x0f\xb6\xcb\x07\xfa\x1bW$o\x19\x0f\xf8g\xbeM\xf9 \x1aG\x0e\xd7\x9aZ\xd6od\xf3\xf1\x07\xe4\x88\x8c*\xb6\xfb\xe2\xad_\xa4\x0c\xfc\x13\xd5h\x83\x86Vo\x90I\xc62\xa0\x8cMX\xdf\x9b\xe8\x9e\x87\xc3tn#\xa6\x1f\x9f.\xa5b\t4:;\x1bC'\xfe#\xddN\x9fn\x94\x8e\x9d\xe6L\xa9#\xda\x13\xf0k|6\xac2\xa0G\xef\xe6\x89"

Decrypted Message Received by Alice from Bob:
'Alice, will you marry me?'




Reference: http://en.wikipedia.org/wiki/Public-key_cryptography

Sunday, June 9, 2013

Hierarchial Design using MyHDL

My aim today is to learn modular style of programming to MyHDL for reusability purpose. I am trying to implement multiple instances in a single VHDL file and I find it easy to implement using MyHDL.

Here is the python script.

Here is the resulting VHDL file.

Here is the resulting RTL schematic from Quartus II

Saturday, June 8, 2013

Experimenting with MyHDL

MyHDL is a very good tool to convert python code to VHDL or Verilog. It can encapsulate a user from writing VHDL and Verilog codes. Since I am using Python for years, I opt to reuse it instead of learning VHDL or Verilog. Just to share, I tried to create a simple project using Altera Quartus as an experiment.

Here is a simple code in python.

The output in VHDL is here.

The resulting RTL from Quartus:



I was impressed because MyHDL is smart enough to recognize if a pin is used as an output or input.

Sunday, February 17, 2013

Repair: Weird clicking sound on Zoom G2.1NU's Pedal

Did you hear some clicking sound when you use your G2.1NU's built-in expression pedal? If yes, stop using it. Investigate. There is a possibility the the potentiometer inside is hitting the end of its wiper when the pedal is pressed and unpressed. This will limit the gear inside. Worse, it could the damage the gear and potentiometer inside.

I had this problem this morning and this is how I solved it.

Remove all the screws.
Open the case until you see the electronics boards inside.
Encircled in red is the potentiometer's location.


Remove the two screws to loosen up the potentiometer and the gear


Readjust the gear of the potentiometer.Do a trial and error until the clicking sound disappear.
Reassemble the unit.
Do a pedal calibration. Press and hold "Pedal Assign" thne on the unit.
Plug in your guitar.
Enjoy.