Steve,
I took a look at the Microchip AN1340 appnote "MRF89XA Radio Utility Driver Program".
Link: http://www.microchip.com/wwwAppNotes...pnote=en549380
I downloaded the Source Code from that link and reviewed the interface Write/Read routines to the MRF89Xa.
They do indeed account for the Preamble and Postamble I mentioned earlier.
Notice what they do with address during the RegisterSet and RegisterRead functions before they call the SPIPut function.
Code:
void RegisterSet(BYTE address, BYTE value)
{
volatile BYTE tmp0RFIE = PHY_IRQ1_En;
#if defined(__PIC24F__)
volatile BYTE tmp1RFIE = PHY_IRQ0_En;
#endif
PHY_IRQ1_En = 0;
#if defined(__PIC24F__)
PHY_IRQ0_En = 0;
IEC0bits.T2IE = 0;
#endif
Config_nCS = 0;
address = (address<<1);
SPIPut(address);
SPIPut(value);
Config_nCS = 1;
PHY_IRQ1_En = tmp0RFIE;
#if defined(__PIC24F__)
PHY_IRQ0_En = tmp1RFIE;
IEC0bits.T2IE = 1;
#endif
BYTE RegisterRead(BYTE address)
{
volatile BYTE tmp0RFIE = PHY_IRQ1_En;
#if defined(__PIC24F__)
volatile BYTE tmp1RFIE = PHY_IRQ0_En;
IEC0bits.T2IE = 0;
#endif
BYTE value;
Config_nCS = 0;
address = ((address<<1)|0x40);
SPIPut(address);
value = SPIGet();
Config_nCS = 1;
PHY_IRQ1_En = tmp0RFIE;
#if defined(__PIC24F__)
PHY_IRQ0_En = tmp1RFIE;
IEC0bits.T2IE = 1;
#endif
For a Write (RegisterSet) they leftshift the address 1 position.
For a Read (RegisterRead) they leftshift the address 1 position and then OR that with 0x40 (sets bit6)
Hope this helps.
Bookmarks