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

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
makes it wait for processor B when this set of conditions occur. That’s what the code above does. So if processor A, the
PIC, ask for too much, too fast, processor B, the Propeller, says “hold on a minute, let me finish the last thing!”.
The function that actually sends the command is listed below:
// this function is used to send SPI commands to the Propeller slave processor
long SPI_Prop_Send_Cmd2(int cmd, int data, int status)
{
1:
2:
3:
4:
5:
6:
7:
8:
9 :
10:
} // end SPI_Prop_Send_Cmd2
Even though you don’t directly call this function, its where all the action happens. Let’s go thru it line by line (I have added
manual line numbers in the listing to help). The function uses the built in SPI hardware and makes calls to the SPI
functions we already developed, so that makes things a lot easier. Here’s how it works:
Propeller Chip Selection
Step 1: Line 1 – here we select channel 2 with the SPI mux, this chip selects the Propeller chip as the target for SPI
traffic.
Data Transmission
Step 2: Lines 2,3 – here we simply send the 1st byte of the command packet and retrieve the 1st byte back in a buffer.
Step 3: Lines 4,5 – here we simply send the 2nd byte of the command packet and retrieve the 2nd byte back in a buffer.
Step 4: Lines 6,7 – here we simply send the 3
Propeller Chip De-Selection
Step 5: Lines 8,9 – here we de-select channel 2 with the SPI mux and select channel 0 (the NULL channel).
Results
Step 6: Line 10 – We return the 8-16 bit result to caller.
This is how all commands are sent to the Propeller chip.
Example(s):
command list in CHAM_PIC_I2C_SPI_DRV_V010.h (also the Propeller driver CHAM_DEFAULT2_DRV_112.SPIN has
the same list) and look up the command we want; GFX_CMD_NTSC_CLS, and now send the command with a function
call.
// clear the NTSC screen, this command takes no parameters, thus send 0,0 for data bytes.
SPI_Prop_Send_Cmd( GFX_CMD_NTSC_CLS, 0x00, 0x00);
_______________________________________________________________________________________________
long status_low, status_high, status_busy;
// set CS to SPI select, select Prop SPI channel = 2
// send command byte and retrieve low byte of result
// send command byte and retrieve high byte of result
// send command byte and retrieve busy byte of result
// set CS to SPI select channel 0 (null)
status_low = SPI_WriteRead( cmd );
DELAY_US(SPI_PROP_CMD_DELAY_US);
status_high = SPI_WriteRead( data );
DELAY_US(SPI_PROP_CMD_DELAY_US);
status_busy = SPI_WriteRead( status );
DELAY_US(SPI_PROP_CMD_DELAY_US);
SPI_SET_CS(SPI_CS_0);
SPI_SET_CS(SPI_CS_PROPELLER);
DELAY_US(SPI_PROP_CMD_DELAY_US);
return( (status_busy << 16) | (status_high << 8) | (status_low) );
Send command to NTSC driver to clear the screen. So first thing we do is look in the header file at the
rd
byte of the command packet and retrieve the 3rd byte back in a buffer.
© 2009 NURVE NETWORKS LLC “Exploring the Chameleon PIC 16-Bit”
168

Related parts for Chameleon-PIC