Chameleon-PIC Nurve Networks, Chameleon-PIC Datasheet - Page 161

MCU, MPU & DSP Development Tools PIC24 & PROPELLER DEV SYSTEM (SBC)

Chameleon-PIC

Manufacturer Part Number
Chameleon-PIC
Description
MCU, MPU & DSP Development Tools PIC24 & PROPELLER DEV SYSTEM (SBC)
Manufacturer
Nurve Networks
Datasheet

Specifications of Chameleon-PIC

Processor To Be Evaluated
PIC24
Data Bus Width
16 bit
Interface Type
USB, VGA, PS/2, I2C, ISP, SPI
Operating Supply Voltage
3.3 V, 5 V
Lead Free Status / RoHS Status
Lead free / RoHS Compliant
STOP conditions, while the receiver is responsible for acknowledging the reception. An Acknowledge (ACK) is signaled by
the receiver pulling the SDA line low during the 9th clock cycle pulse on SCL. If the receiver leaves the SDA line high, a
“NACK” (no ACK) is signaled, and the transfer is not completed.
In conclusion, I
state machine, bus contention and so forth. However, the PIC24 has built in I
much easier to implement. Setting up the registers is still a bit challenging and you have to read the documentation quite a
bit to get the hang of it. I suggest you review the following references for a more complete treatise on I
Now, let’s move onto the SPI and I
hardware. Moreover, you may wish to develop much higher level functionality yourself.
19.3 Header File Contents Overview
The “SPI and I2C” module header CHAM_PIC_I2C_SPI_V010.h is very important since it houses the constants for the
SPI communications interface to the Propeller, so we are going to cover it in detail. Let’s begin with the #defines that
declare some of the hardware signals and constants used to represent I
// Selects the appropriate device
#define SPI_SET_CS(DEVICE) { PORTB &= ~(0xC000); PORTB |= DEVICE; }
// --- I2C defines ---
// I2C clock in Hz
#define I2C_DEFAULT_CLOCK
// --- SPI defines ---
// Chip select choices
#define SPI_CS_0
#define SPI_CS_1
#define SPI_CS_PROPELLER
#define SPI_CS_FLASH
The #defines simply declare the macros, chip selections and some timing constants. For example,
I2C_DEFAULT_CLOCK is a convenient constant to pass the initialization function (covered later).
Notice the macro SPI_SET_CS(DEVICE). This macro is meant to be called in your normal C code with the following
SPI_CS_X define choices. Effectively what this will do is it will reconfigure the I/O port selections and SPI chip select
hardware to cause the device passed in to be selected.
Next, there are some timing constants that slow things down and makes sure when SPI commands are sent to the
Propeller that the PIC waits long enough before issuing another command. These don’t matter too much as the drivers
evolved, but were needed in earlier driver development:
// these two defines "throttle" the SPI interaction with the virtual SPI software interface on the Prop
#define SPI_PROP_STRING_DELAY_US
#define SPI_PROP_DELAY_SHORT_US
#define SPI_PROP_DELAY_LONG_US
#define SPI_PROP_CMD_DELAY_US
The next set of #defines are rather long, they represent all the current commands that the Propeller driver understands.
These commands each have a specific set of parameters and functionality that will be clarified when we review the
individual APIs for each class of messages; graphics, sound, keyboard, etc.
// display devices
#define DEVICE_NTSC
#define DEVICE_VGA
// PROP SPI driver media and IO command set
// SPI commands
#define CMD_NULL
DVD-ROM:\ CHAM_PIC \ DOCS \ I2C \ I2C_bus.pdf
DVD-ROM:\ CHAM_PIC \ DOCS \ I2C \ Section19-I2C.pdf
2
C is a lot more complex that SPI, and writing a software implementation is a lot harder as well due to the
0
1
0
250 // the prop needs time to react to each spi terminal print command
(100)
(250)
1
// the prop needs time to react to each spi transition, this delay insures it can keep up
// if you optimize the Prop driver or convert to ASM then you can reduce this of course
100000L // initially set to 100Khz, this is the default when you call I2C_Init(0)
0x0000
0x4000
0x8000
0xC000
// this delay is used where the critical path thru the SPI/Prop is relatively short
// this delay is used where the critical path thru the SPI/Prop is relatively long
2
C library module that implements a very thin layer of software on top of the built in
© 2009 NURVE NETWORKS LLC “Exploring the Chameleon PIC 16-Bit”
2
C and SPI interfaces):
2
C hardware as mentioned which makes it all
2
C:
161

Related parts for Chameleon-PIC