element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Personal Blogs
  • Community Hub
  • More
Personal Blogs
Cosmin Iorga's Blog Testing and Debugging the Brainwaves Appliance Controller
  • Blog
  • Documents
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: ciorga
  • Date Created: 9 Dec 2014 4:03 AM Date Created
  • Views 958 views
  • Likes 0 likes
  • Comments 3 comments
  • brainwaves_appliance_control
  • psoc5lp
Related
Recommended

Testing and Debugging the Brainwaves Appliance Controller

ciorga
ciorga
9 Dec 2014

It feels as if it has been forever since I started to work on this project and I am not done yet.  So far I was able to build a brainwaves appliance controller using a PSoC5LP chip,  a Schmartboard prototype board and an infrared remote control code learner in a Cypress CY8CKIT-001 evaluation kit.  Both worked well separately but when I put them together in the same PSoC5LP chip I ran into problems.  In my previous blog post I showed how I implemented the brainwaves appliance controller together with the infrared code learner in the Cypress CY8CKIT-001 evaluation kit, and I mentioned that it looked functional.  Yes, it did for the experiments I tried at that time, which I covered in the previous blog post.  After that I started a more thorough testing of all combinations of functions and modes.  During this testing I discovered a combination of steps that sometimes locks up the system.  For example if I set the system to learn two codes in sequence from a DVD player remote control and then transmit one of the codes using the emulated eye-movement sometimes the system locks up.  To unlock it, I had to reset the PSoC5LP, but transmitting the same code would lock the system again.  This problem did not show with remote control codes learned from other remote controls I tested. 

 

So, I have spent most of the time after my previous update troubleshooting this problem and a few other software bugs that showed up during this testing activity.  The most difficult part was the intermittent nature of this problem, so I had to repeat the sequence of commands a few times to see the problem.  I started the troubleshooting process by looking at the difference between the codes of the DVD player remote control and a working remote control.  To visualize the transmitted infrared code I used two types of infrared sensors, one that measures the raw signal and another one that outputs the demodulated signal.  The two sensors are mounted on the prototype board shown in the figure below, and the outputs are probed with a Tektronix TBS 1202B-EDU oscilloscope.

 

image

 

First I measured the infrared carrier frequency of the two remote control units.  The signal from the working remote control unit is shown in the figure below:

 

image

 

The upper waveform in blue represents the raw signal that contains the infrared carrier component.  The lower waveform in yellow represents the demodulated signal.  The oscilloscope’s built-in frequency measurement shows 39.53kHz for the channel 2 waveform (blue trace), which is the carrier frequency.

 

The non-working remote control waveforms are shown in the following picture:

 

image

 

The measured carrier frequency is 40.3kHz, which is close to the 49.53kHz measured for the working remote control, so I concluded that the carrier frequencies of these two remote control units are close enough not to be the cause of the problem I was troubleshooting.

 

Next I “zoomed” out to see the entire transmitted packets for these two remote controls.  The following plot shows the data packet transmitted by the working remote control.

 

image

 

At the beginning there is a preamble that synchronizes the demodulator in the receiver.  Following the preamble it is the actual data code after which there is a quiet section until the next data packet.  I used the built-in cursor function in the TBS 1202B-EDU oscilloscope to measure the length of the quiet region, as shown in the picture.  The measure value, which is displayed on the right side, was 39ms.

 

Then I measured the transmitted data packet of the non-working remote control, as shown in the following picture.

 

image

 

First impression was that this data packet looks totally different compared to the working remote control.  I also used the cursors to measure the length of the quiet region as 14ms. 

 

The lengths of the quiet regions were different between the two remotes, but other things were different, too.  After many hours (and days) of debugging I found out what was happening.  Here is the schematic of the data processing inside the PSoC5LP chip:

 

image

 

The system identifies the end of a data packet by measuring the length of the quiet region.  This is done by Timer_4 in the schematic above, which sends an interrupt request to the MCU after each data packet (end_of_code_ISR).  The threshold for deciding if there is an end of code was set to 35000 counts, which was equivalent to 14.583ms, as shown in the configuration form.  For the working remote control this value was just fine because the length of the quiet region was 39ms, but for the non-working remote control measured length of the quiet region was 14ms, which was marginal to the 14.583ms setting.  So, sometimes the end of code was not detected resulting in overflow of the receiving array.  After lowering the threshold value the system worked fine.  I still cannot explain the lock-up state (it must be additional things happening in the program caused by this overflow), but now it does not happen anymore.

 

This was one of the problems; I am still discovering software bugs, but so far they’ve been easy to debug and fix.  So I am not done with the verification, and I estimate I will spend the  next few weeks continuing this testing.  I really want to be confident that everything works well before designing the printed circuit board and the rest of the assemblies for this brainwaves appliance controller project.

 

That’s it for now; I will come back with a new update as I get more work done.

 

Best Wishes,

Cosmin

  • Sign in to reply
  • ciorga
    ciorga over 10 years ago in reply to DAB

    Hi DAB and John,

    Thank you for your comments; yes, I am still working on this project even though recently I was busy with other commitments.  I hope to finish it in the next 2-3 months.

    Best Wishes,

    Cosmin

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • DAB
    DAB over 10 years ago

    Great Post Cosmin,

     

    I am glad that you are returning to this project.

    I always felt that there was a lot more fun to be had as you looked into the IR Protocol.

     

    DAB

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • jw0752
    jw0752 over 10 years ago

    Hi Cosmin, I enjoyed reading about your problem solving procedures. Sometimes when I am repairing something (always much simpler that what you are doing), I have to tell myself that there is no magic and that I will eventually find the cause of the failure or the intermittent. It is quite a rush when one finally does stumble on or analyze the solution to the problem. Surprisingly in hind sight it seems to usually be a simpler problem that I anticipated. Your posts are always appreciated.

    John

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube