Defines

board_wimod.h File Reference

IMST GmbH WIMOD w/ mega328 and AT86RF230B. More...

Go to the source code of this file.

Defines

#define BOARD_WIMOD_H   (1)
#define DDR_KEY   DDRC
#define DDR_SPI   (DDRB)
#define DDR_TRX_RESET   DDRD
#define DDR_TRX_SLPTR   DDRB
#define DEFAULT_SPI_RATE   (SPI_RATE_1_2)
#define DI_TRX_IRQ()   {TIMSK1 &= ~_BV(ICIE1);}
#define EI_TRX_IRQ()   {TIMSK1 |= _BV(ICIE1);}
#define HIF_TYPE   HIF_UART_0
#define HWTIMER_REG   (TCNT1)
#define HWTIMER_TICK   ((1.0*HWTMR_PRESCALE)/F_CPU)
#define HWTIMER_TICK_NB   (0xFFFFUL)
#define HWTMR_PRESCALE   (1)
#define INVERSE_KEYS   (1)
#define LED_DDR   DDRD
#define LED_MASK   (0x1c)
#define LED_NUMBER   (3)
#define LED_PORT   PORTD
#define LED_SHIFT   (2)
#define LEDS_INVERSE   (1)
#define MASK_KEY   (0x07)
#define MASK_TRX_RESET   (_BV(PD6))
#define MASK_TRX_SLPTR   (_BV(PB1))
#define PIN_KEY   PINC
#define PORT_KEY   PORTC
#define PORT_SPI   (PORTB)
#define PORT_TRX_RESET   PORTD
#define PORT_TRX_SLPTR   PORTB
#define PULLUP_KEYS   (1)
#define RADIO_TYPE   (RADIO_AT86RF230B)
#define SHIFT_KEY   (0)
#define SPI_DATA_REG   SPDR
#define SPI_MISO   _BV(PB4)
#define SPI_MOSI   _BV(PB3)
#define SPI_SCK   _BV(PB5)
#define SPI_SELN_HIGH()   PORT_SPI |= SPI_SS; SREG = sreg
#define SPI_SELN_LOW()   uint8_t sreg = SREG; cli(); PORT_SPI &=~SPI_SS
#define SPI_SS   _BV(PB2)
#define SPI_WAITFOR()   do { while((SPSR & _BV(SPIF)) == 0);} while(0)
#define TIMER_INIT()
#define TIMER_IRQ_vect   TIMER1_OVF_vect
#define TIMER_POOL_SIZE   (4)
#define TIMER_TICK   (HWTIMER_TICK_NB * HWTIMER_TICK)
#define TRX_IRQ_INIT()
#define TRX_IRQ_vect   TIMER1_CAPT_vect
#define TRX_RESET_HIGH()   PORT_TRX_RESET |= MASK_TRX_RESET
#define TRX_RESET_INIT()   DDR_TRX_RESET |= MASK_TRX_RESET
#define TRX_RESET_LOW()   PORT_TRX_RESET &= ~MASK_TRX_RESET
#define TRX_SLPTR_HIGH()   PORT_TRX_SLPTR |= MASK_TRX_SLPTR
#define TRX_SLPTR_INIT()   DDR_TRX_SLPTR |= MASK_TRX_SLPTR
#define TRX_SLPTR_LOW()   PORT_TRX_SLPTR &= ~MASK_TRX_SLPTR
#define TRX_TSTAMP_REG   TCNT1

Detailed Description

IMST GmbH WIMOD w/ mega328 and AT86RF230B.

see http://www.mikrocontroller.net/attachment/101618/WiMOD240.jpg

The wiring of the radio and the ATmega is shown below.

     AVR         RF230
     ---         -----
     PB0    <--  INT / ICP1
     PB1    -->  SLPTR
     PB2    -->  /SEL
     PB3    -->  MOSI
     PB4    <--  MISO
     PB5    -->  SCK
     PB6 intentionally unused for XTAL1
     PB7 intentionally unused for XTAL2
    (T1) PD5   <--  CLKM
         PD6   --> /RST
         PD7   --> TST
    USART:
        PD0 RXD
        PD1 TXD
    LED:  None
    KEY:  None
  IM240A      Mega328  Adapter   EvalBoard
  Pin Name              AB_01
  -----------------------------------------
   8  ADC1    ADC7      X1.12
   9  ADC2    ADC6      X1.14
  12  GPIO1   PC0       X1.15     Button1
  13  GPIO2   PC1       X1.16     Button2
  14  GPIO3   PC2       X1.19     Button3
  15  GPIO4   PC3       X1.18     DSW1
  21  GPIO5   PC5       X2.9
  23  GPIO6   PC4       X2.11
  18  DIO1    PD0       X2.18      UART-RX
  19  DIO2    PD1       X2.15      UART-TX
  20  DIO3    PD2       X2.7       LED4
  24  DIO4    PD3       X2.6       LED3
  25  DIO5    PD4       X2.5       LED2
Build Options
Note:
In order to use the eval board be shure to follow the install guide.
  • replace jumper e by cable e1 on X5
  • switch S1 to power supply USB.

To program the mega328pa connect JTAG-ICE 10 pin header to X4.

avrdude -P usb -c jtag2isp -p m328p -B10 -t

The original fuses are LF 0xe2 HF 0xd4 EF 0x06

The original bootloader seems to be a proprietary one and handles the ISMT *.wfi format. It is a one line string starting with "WIMOD_ID_3#" followed by probably the ASCII representation of the firmware ... to be investigated.

In order to do a backup of the board use the following commands:

    avrdude -P usb -c jtag2isp -p m328p -B 10 -U fl:r:im240a_flash_initial.hex:i
    avrdude -P usb -c jtag2isp -p m328p -B 10 -U ee:r:im240a_eeprom_initial.hex:i
   

Restoration of the backup can be done by the command:

  avrdude -P usb -c jtag2isp -p m328p -B 10 \
            -U fl:w:im240a_flash_initial.hex:i \
            -U ee:w:im240a_eeprom_initial.hex:i \
            -U lf:w:0xe2:m \
            -U hf:w:0xd4:m \
            -U ef:w:0x06:m
    

Define Documentation

#define DI_TRX_IRQ (  )     {TIMSK1 &= ~_BV(ICIE1);}

disable TRX interrupt

#define EI_TRX_IRQ (  )     {TIMSK1 |= _BV(ICIE1);}

enable TRX interrupt

#define HWTMR_PRESCALE   (1)

Mode: normal Prescaler: 1 Overflow: 0xFFFFUL

#define TIMER_INIT (  ) 
Value:
do{ \
        TCCR1B |= (_BV(CS10)); \
        TIMSK1 |= _BV(TOIE1); \
    }while(0)
#define TRX_IRQ_INIT (  ) 
Value:
do{\
                            /* TCCR1B |= (_BV(ICNC1) | _BV(ICES1) | _BV(CS12) | _BV(CS10)); */\
                            TCCR1B |= (_BV(ICNC1) | _BV(ICES1));\
                            TIFR1 = _BV(ICF1);\
                          } while(0)

init interrupt handling

  • transceiver IRQ at PB0
  • rising edge triggers ICP1 (ICES1),
  • timer capture is enabled (ICF1)
#define TRX_IRQ_vect   TIMER1_CAPT_vect

interrupt vector name

#define TRX_TSTAMP_REG   TCNT1

timestamp register for RX_START event


This documentation for µracoli was generated on Tue Apr 9 2013 by  doxygen 1.7.1