Clock configuration atxmega + rf231 via SPI

Go To Last Post
2 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi all,
TASK:
I'm configuring the clocks in a configuration where an atxmega256a3 is interfaced to a at86rf321 radio via spi (MISO/MOSI/IRQ/CLK).
RF231 data says that I can read the reference clock from pin 17 (MCLK) and use it as feed for a micro, but, in my case such pin is left unused (not connected to the micro).

Communication is working with the WSNDemo application, which proves that the hardware is fine.

In my code (not WSNDemo), I'm using a xmega master clock @32MHz, SPI clock at 4MHz and I'm using the RF231 internal oscillator clock @1MHz (I've probed pin 17 and it reads 1MHz).
In this configuration - xmega@32MHz, SPI@4MHz, RF@1MHz with 2 clock refs (xmega and rf231)- I can read and write registers on the radio correctly BUT I'm not able to get an interrupt by the radio (or at least I'm not reading any on the micro, regardless the fact that I'm sending packets on the same channel and I have the following IRQ enabled on the rf: TRX_IRQ_AMI | TRX_IRQ_RX_START | TRX_IRQ_TRX_END;
I know the IRQ is working on the micro as I can see the callback being triggered if I shortcircuit the IRQ pin with Vcc.

I'd like to know if the clock config I'm using is oK (so I have to check something else) or if this configuration can be responsible for the micro not getting any interrupt on the IRQ pin.

Just a final piece of information: the spi IRQ pin is configured as follows:

#define RF_PORT PORTC
RF_PORT.PIN2CTRL = PORT_ISC_RISING_gc | PORT_OPC_TOTEM_gc;
RF_PORT.INTFLAGS = PORT_INT0IF_bm;
RF_PORT.INT0MASK = PIN2_bm;
PMIC.CTRL |= PMIC_HILVLEN_bm;
RF_PORT.INTCTRL |= PORT_INT0LVL_HI_gc;

I understand it's complicated and poorly detailed but I'd probably feel much better with just some simple general purpose advices about typical clock configurations to use.

Regards,
R

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have similar setup but I use Atmega164P and not Xmega. I can't see why your setup shouldn't work.

If you don't use the clock from the RF231 it's better to disable it.

Perhaps you can do a "register dump" (read all register and print it in a terminal) just to make sure you set all the registers correct.