PHOTO 2. The PmodUSBUART is a
direct replacement for the
PmodRS232. This little bugger also
works really good in solderless
breadboard projects.
625 kbps in Turbo mode seems to
be overkill. However, you really
don’t have to drive your Ferrari at
200 MPH either. In the case of the
PmodRF2 and the Ferrari, the speed
is there if we need it. A high speed
PmodRF2 is stopped under the lens
in Photo 1.
USB Wins
Again
USB has been underbidding
and winning contracts over RS-232
for some time now. Chalk up another win for the
embedded USB interface. The PmodUSBUART positioned in
Photo 2 is based on the FTDI FT232RQ and will be used to
bridge the data gap between the Cerebot
32MX7/PmodRF2 system and a PC terminal emulator.
The PmodUSBUART replaces the PmodRS232 module
and the associated serial-to-USB cable. Pushing a power rail
through an RS-232 connector was (and is) a pain in the
ground plane. Like most other USB interface
implementations, the PmodUSBUART module can be
powered from the host system power supply or via the host
system USB portal.
door to a code space in which we will deposit our Cerebot
32MX7-specific hardware definitions.
The various PICs used in the Simple Demo application
employ differing ways of implementing NVM (Non-Volatile
Memory). Some microcontrollers use their internal EEPROM,
while others may use external EEPROM or program Flash.
We’ll configure our Cerebot 32MX7 to use program Flash
as its NVM element:
#if defined(CEREBOT32MX7)
#define USE_PROGRAMMING_SPACE
32-bit MiWi
As mentioned, Mi Wi is a Microchip protocol that can
be used in very simple wireless 802.15.4 networks. You can
get your own copy of Mi Wi by downloading the latest
version of the Microchip Application Libraries. The majority
of the applications found within the Application Libraries —
including Mi Wi — are written for the out-of-the-box
Microchip hardware development tools. Despite the various
development tool configurations, the core device is a PIC. In
the case of the Cerebot 32MX7, that microcontroller is the
32-bit PIC32MX795F512L. So, our job is to wedge the
Cerebot 32MX7 hardware configuration into the existing
Mi Wi hardware definitions. We’ll use the Application
Libraries’ Mi Wi Simple Example for the PIC18 Explorer
development board as our template.
The Application Libraries applications must be written
in such a way as to encompass all of the applicable PIC
devices. For instance, as I mentioned earlier, we’re going to
base our modifications on the Mi Wi Simple Demo PIC18
Explorer code. The reason for this is that the Mi Wi code
only supports the PIC32MX795F512L as a PIM mounted on
the Explorer development board.
So, now that we know the modification base device,
along the way we’ll get rid of some of the obvious
decisions embedded in the original code. Our first
modification is a perfect example elimination of obvious
code:
#if defined(PIC18_EXPLORER)
#define CLOCK_FREQ 10000000
#define USE_EXTERNAL_EEPROM
#define EEPROM_SHARE_SPI
Elbowing Into
HardwareProfile.h
Wars begin with a single shot. The invasion of the
Mi Wi Simple Demo’s HardwareProfile.h file begins with this
simple definition:
#define CEREBOT32MX7
The aforementioned #define declaration opens the
#elif defined(MRF24J40)
#define RFIF INTCON3bits.INT1IF
#define RFIE INTCON3bits.INT1IE
We already know that the PmodRF2 is based on the
MRF24J40. So, there’s no need to base any coding
decisions on any other radio. The Cerebot 32MX7’s INT0,
INT1, and INT2 external interrupt signal lines are not
available to us to use in our ported Mi Wi application. So,
we must do some work on the RFIF and RFIE definitions,
which is basically take what we can get. The next available
interrupt line is INT3. We’ve already taken care of the NVM
space definition. That leaves only the CLOCK_FREQ
SERVO 10.2011 49