[mc1322x] suggestions for code errata

Peter Lawrence majbthrd at gmail.com
Fri Oct 9 16:12:54 EDT 2009


Sorry, everyone, for the extra email.  The comments in my code example
are backwards. It should be:

> #ifdef USE_PA
> reg(ADDR_POW2) = 0xffffdfff & PAVAL[power]; /* dual port */
> #else
> reg(ADDR_POW2) = 0x00002000 | PAVAL[power]; /* single port */
> #endif

On Fri, Oct 9, 2009 at 4:03 PM, Peter Lawrence <majbthrd at gmail.com> wrote:
> Hmmm... I can't fault your interpretation.  I'm seeing the assembly in
> the same way you did.
>
> I think I've figured it out, though.
>
> It seems to be the product of a very efficient compiler as a way to
> set r3 to 0x2000 in only two Thumb instructions.
>
> Bit 13 (the bit set by pre-initializing r3 to 0x2000) of POW2,
> although NOT documented in the RM, is indicated elsewhere as
> controlling whether PA_POS and PA_NEG are used.  (These are the
> differential outputs for use with an external PA.)
>
> The mystery r1=1 mode accesses 403e00 (.word   0xffffdfff) which is
> used to clear bit 13.
>
> Bit 13 apparently should be set for single port mode (just use
> RF_RX_TX), and cleared for dual port mode (use PA_POS and PA_NEG).
>
> So, another way of writing the code could be:
>
> #ifdef USE_PA
> reg(ADDR_POW2) = 0xffffdfff & PAVAL[power]; /* single port */
> #else
> reg(ADDR_POW2) = 0x00002000 | PAVAL[power]; /* dual port */
> #endif
>
> Technically speaking, PAVAL already has bit 13 set (so the OR is
> unnecessary), but doing the OR makes it more fool-proof.



More information about the mc1322x mailing list