Archive for August, 2007

PSOC and ARMs

It would not come as much of a shock to most if I said engineers in general get comfortable with particular tools of the trade (microcontrollers, languages, chips, etc.) and resist change as much as possible. This is not without some good reason, as all the time spent getting familiar with the published and unpublished “features” of a particular system are sunk costs that precludes one from examining more than a few alternatives.

 I am like this, and my comfort zone currently in terms of embedded systems is the Cypress PSOC. I like its design tools (PSOC Designer, not the PSOC Express), like the analog/digital blocks that can be reconfigured, and even the much maligned M8C core. (Its assembly instruction set is very similar to my all-time favorite, the 6502)

 However, even Cypress has realized that the M8C 8 bit core is a little underpowered. Apparently they have been designing the next generation (PSOC3) chip that utilizes an ARM Cortex M3 core, (and another version with an 8051 core). I’ve heard good things about the ARM series, but since they were 16/32 bit systems with a huge development suite, I resisted. Not to mention the cost of a beginning development board/system was much higher than for the PSOC.

With Cypress’s move to the ARM architecture, however, I have decided to sit down and learn more about ARMs. PSOC3’s haven’t come out yet, but I am thinking of getting an ARM SAM7 board from my favorite PCB fab company, Olimex. The SAM7-EX256 board looks pretty feature-full, and it even includes a color LCD to boot (this year’s mobile robotics course has taught me the necessity of having an LCD for debugging purposes).

The price is a bit steep ($199) but I think well worth it. Fortunately, there is an open source development suite, the WinARM that includes gcc, Eclipse, and a gdb/insight based debugger. All in all a “professional” development environment. I don’t have enough time to learn yet another assembly language, so being able to use a (free) C compiler is practically a requirement.

More on my ARM adventures once I get the board.

Comments off

PSOC Timer16 Datasheet Error

I teach another course, an embedded programming and robotics course. For the embedded programming part I use the Cypress Semiconductor PSOC (Programmable System On a Chip), which is a really versatile microcontroller/SOC.

 I have been trying to interface an ultrasonic transducer to the PSOC using the Timer user module, and came across an error in the datasheet. I posted the following on www.psocdeveloper.com, a website that is devoted to the PSOC, but didn’t receive an answer. Luckily I was able to figure it out myself!

I am examining the output of the Device configurator
for a Timer16 module, for both InvertCapture set to
Normal and Invert.Now the Datasheet says that the
"Data Invert" Bit exists in Bit 7 of the Bank 1 MSB
Function Register.Looking at the generated
psocconfigtbl.asm file, it appears that the bit that
is being set/cleared by the Designer is the LSB
Function RegisterInvertCapture Normal:

; Instance name T, Block Name TIMER16_LSB(DCB22)
db 48h, 00h ;T_FUNC_LSB_REG(DCB22FN)
; Instance name T, Block Name TIMER16_MSB(DCB23)
db 4ch, 20h ;T_FUNC_MSB_REG(DCB23FN)
InvertCapture Inverted:
; Instance name T, Block Name TIMER16_LSB(DCB22)
db 48h, 80h ;T_FUNC_LSB_REG(DCB22FN)
; Instance name T, Block Name TIMER16_MSB(DCB23)
db 4ch, 20h ;T_FUNC_MSB_REG(DCB23FN)

Does anyone know which is correct, the IDE or the datasheet?
I am using 4.3 and have checked the 4.4 release notes but
don't see this mentioned at all.

 I posted the solution as well:

The data sheet is indeed incorrect and the IDE does
generate the proper code (LSB). what was preventing
me from quickly deducing this was a bug in my own code,
which failed to set the bank to 1 before changing the
register.It now works and I can dynamically flip between
normal and inverted capture.

The code I wrote (and fixed) is:
Ping_Capture_Normal:
 M8C_SetBank1
 mov reg[PingT_FUNC_LSB_REG],Ping_CAPTURE_NORMAL
 M8C_SetBank0
 ret
Ping_Capture_Inverted:
 M8C_SetBank1
 mov reg[PingT_FUNC_LSB_REG],Ping_CAPTURE_INVERTED
 M8C_SetBank0
 ret

Comments off