Breaking News
Comments
Oldest First | Newest First | Threaded View
Page 1 / 2   >   >>
Max The Magnificent
User Rank
Blogger
Being prodded into action
Max The Magnificent   6/27/2014 3:12:00 PM
NO RATINGS
Hi Aubrey -- I have one each of the PSoC 4100 and 4200 prototyping kits sitting on my desk -- and also a PSoC 4 Pioneer Kit -- your blogs are prodding me into action with regard to using them in one of my hobby projects.

betajet
User Rank
CEO
"volatile"
betajet   6/27/2014 3:48:48 PM
NO RATINGS
Aubrey wrote: ... the compiler had optimized away the dummy memory accesses like cDummy++; ...

Most C compilers let you declare a variable to be "volatile", e.g.,

    volatile int cDummy;

which tells the compiler not to optimize loads and stores to that variable.  "volatile" is mostly used to identify a variable as memory-mapped I/O, which means it could change value any time, e.g., if it's the current value of GPIO pins.  Writes to a volatile variable may have side-effects like shifting data out though a UART pin.  "volatile" is also used for variables that are shared with interrupt service routines or other tasks.

antedeluvian
User Rank
Blogger
Re: "volatile"
antedeluvian   6/27/2014 4:04:56 PM
NO RATINGS
betajet

Most C compilers let you declare a variable to be "volatile", e.g.,

    volatile int cDummy;

which tells the compiler not to optimize loads and stores to that variable.  "volatile" is mostly used to identify a variable as memory-mapped I/O, which means it could change value any time, e.g., if it's the current value of GPIO pins.  Writes to a volatile variable may have side-effects like shifting data out though a UART pin.  "volatile" is also used for variables that are shared with interrupt service routines or other tasks


Thanks for pointing this out. However, it seems to me that I adopted a rather poor and even inelegant method of creating code usage. It would have been better of me to adopt the use of assembly instructions like asm ("nop");

 

KB3001
User Rank
CEO
Debugging
KB3001   6/29/2014 11:49:20 AM
NO RATINGS
Did you consider using Keil MDK for software development especially debugging?

Garcia-Lasheras
User Rank
Blogger
Re: "volatile"
Garcia-Lasheras   6/29/2014 5:12:22 PM
NO RATINGS
@Antedeluvian: The idea has been bouncing around in my head for some time now, but after reading your blogs, I'm completely sure I want to try one of these PSoC devices ;-)

About the ARM code, you have mentioned Keil compiler. Do I need to buy a Keil license in order to work with the PSoC 4 device or everything I need is included in the Cypress toolchain?

 

KB3001
User Rank
CEO
Re: "volatile"
KB3001   6/29/2014 6:42:49 PM
NO RATINGS
@Garcia-Lasheras, there is a free Keil download (from www.keil.com) although it's 32k code size limited. I believe PSoC creator uses keil MDK in the background.

antedeluvian
User Rank
Blogger
Re: Debugging
antedeluvian   6/29/2014 8:46:20 PM
NO RATINGS
KB3001

Did you consider using Keil MDK for software development especially debugging?

No. I stayed within PSoC Creator.

antedeluvian
User Rank
Blogger
Re: "volatile"
antedeluvian   6/29/2014 8:49:28 PM
NO RATINGS
Javi

Do I need to buy a Keil license in order to work with the PSoC 4 device or everything I need is included in the Cypress toolchain?

No you don't have to buy anything. I think there is an option which will improve code density or something like that, but so far I haven't bumped into any limitations (and I have used it on the PSoC5 as well). However you do have to register with Keil.

mithrandir
User Rank
Rookie
That annoying debug issue
mithrandir   6/30/2014 12:14:18 AM
NO RATINGS
Yeah the interrupt bug can be quite annoying, I ran into it several times.

If the interrupt isn't quite as critical for what you want to debug, you can disable breakpoints while debugging in Creator(I remember a little lightning symbol which can disable all global interrupts). Not an elegant solution but can work sometimes.

Moving some of my hobby stuff from PSoC5 to PSoC4 felt like quite a step back for me though. You get so used to any pin anywhere you forget that PSoC4 has a quite a few fixed function pins as well. For the sweet price point though, its well worth the sacrifice.

mithrandir
User Rank
Rookie
Re: That annoying debug issue
mithrandir   6/30/2014 1:11:35 AM
NO RATINGS
Oh and in case anyone is interested(note my shameless promotion here),

http://www.embedded.com/design/real-world-applications/4428811/Building-an-electronic-guitar-digital-sound-synthesizer-using-a-programmable-SoC

It uses PSoC5.

Page 1 / 2   >   >>


EE Life
Frankenstein's Fix, Teardowns, Sideshows, Design Contests, Reader Content & More
Max Maxfield

Creating a Vetinari Clock Using Antique Analog Meters
Max Maxfield
25 comments
As you may recall, the Mighty Hamster (a.k.a. Mike Field) graced my humble office with a visit a couple of weeks ago. (See All Hail the Mighty Hamster.) While he was here, Hamster noticed ...

EDN Staff

11 Summer Vacation Spots for Engineers
EDN Staff
11 comments
This collection of places from technology history, museums, and modern marvels is a roadmap for an engineering adventure that will take you around the world. Here are just a few spots ...

Glen Chenier

Engineers Solve Analog/Digital Problem, Invent Creative Expletives
Glen Chenier
11 comments
- An analog engineer and a digital engineer join forces, use their respective skills, and pull a few bunnies out of a hat to troubleshoot a system with which they are completely ...

Larry Desjardin

Engineers Should Study Finance: 5 Reasons Why
Larry Desjardin
45 comments
I'm a big proponent of engineers learning financial basics. Why? Because engineers are making decisions all the time, in multiple ways. Having a good financial understanding guides these ...

Flash Poll
Top Comments of the Week
Like Us on Facebook
EE Times on Twitter
EE Times Twitter Feed

Datasheets.com Parts Search

185 million searchable parts
(please enter a part number or hit search to begin)