- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi all,
In my project im using CYRF 69103, but after programming i'm not able to transmit my data to the second board. Second board also using CYRF69103. Please find my code below! Thank you!
#include <m8c.h>
#include "PSoCAPI.h" // PSoC API definitions for all User Modules
#include "PSoCgpioint.h" // Contains GPIO interrupt definitions
#include "lpregs.h" //‘C’ defines for WUSBLP registers and register fields
#include "lpradio.h" //‘C’ function prototypes and type declarations for the entire radio driver functions implemented in lpstreaming.asm or lpnonstreaming.asm,lpradio.asm and psocradio.asm or e2radio.asm.
#include "stdlib.h" // Standard APIs supported by Image craft compiler
#include "delay.h"
//--------------------------------------
// Local Definitions and Types
//--------------------------------------
// Select channel from 0-98. Make sure even the "Receiving string using CYRF6936 and CY7C604xx" code has the same channel
#define CHANNEL 40
// Select PN code from 0-11. Make sure even the "Receiving string using CYRF6936 and CY7C604xx" code has the same PN code
#define SOP_PN_CODE 2 // 0-11
// Select one DATMODE_1MBPS | DATMODE_8DR | DATMODE_DDR | DATMODE_SDR
#define DATA_RATE DATMODE_8DR
//Sets the payload length
#define PAYLOAD_LENGTH 1
//#define RED_LED_Data_ADDR PRT0DR
//#define GRN_LED_Data_ADDR PRT0DR
#define Button_Data_ADDR PRT2DR
#define M_PWR_led_Data_ADDR PRT0DR
#define M_BUZ_Data_ADDR PRT1DR
#define S_ID 0x23
#define M_ID 0xFE
BYTE TxPayloadBuffer[PAYLOAD_LENGTH];
BYTE RxPayloadBuffer[PAYLOAD_LENGTH];
RADIO_RSSI Tx_Rx_RSSI;
WORD iDelayIndex;
RADIO_STATE LpRadioState;
unsigned char M_TX_DATA=0;
unsigned char M_RX_DATA=0;
void HardwareInit(void);
void InitialiseRadio(void);
unsigned char Call_TX(void);
unsigned char Call_RX(void);
BYTE Port_0_SHADE;
BYTE Port_1_SHADE;
void main(void)
{
// BYTE Port_0_SHADE;
// BYTE Port_1_SHADE;
Port_0_SHADE = 0;
Port_1_SHADE = 0;
M8C_EnableGInt;
SPIM_Radio_Start();
InitialiseRadio();
Port_1_SHADE &= ~M_BUZ_MASK;
M_BUZ_Data_ADDR = Port_1_SHADE;
//M_PWR_led_Data_ADDR=0x08;//ob0000 1000
Port_0_SHADE |= M_PWR_led_MASK;
M_PWR_led_Data_ADDR = Port_0_SHADE;
while(TRUE)
{
if ((Button_Data_ADDR & 0x02) == 0x00)
{
while((Button_Data_ADDR & 0x02) == 0x00);
if (Call_TX())
{
Port_1_SHADE &= ~M_BUZ_MASK;
M_BUZ_Data_ADDR = Port_1_SHADE;
}
else
{
Port_1_SHADE |= M_BUZ_MASK;
M_BUZ_Data_ADDR = Port_1_SHADE;
}
}
}
}
void InitialiseRadio(void)
{
//Variable to generate a delay.
int iDelayIndex;
// DATMODE_8DR needs a little extra time to receive the ACK. -30 dbm transmit power
RadioInit(ACK_EN | END_STATE_SLEEP | ACK_TO_15X, PA_4_DBM|
DATCODE_LEN_32 | DATMODE_8DR);
// Set the transmit frequency (2400MHz + CHANNEL)
RadioSetFrequency(CHANNEL);
// Change the PN Code for the Start of Packet
RadioSetSopPnCode(SOP_PN_CODE);
//Generate a delay so that radio gets stabilized
for(iDelayIndex = 0; iDelayIndex <30000; iDelayIndex++);
}
unsigned char Call_TX(void )
{
TxPayloadBuffer[0] = M_ID;
// Set the transmit buffer
RadioSetPtr(TxPayloadBuffer);
// Set the transmit buffer length
RadioSetLength(PAYLOAD_LENGTH);
// Start the blocking transmit
LpRadioState = RadioBlockingTransmit(2, PAYLOAD_LENGTH);
//Check if Transmit is complete
if( (LpRadioState & (RADIO_ERROR | RADIO_COMPLETE)) == RADIO_COMPLETE)
{
Port_1_SHADE &= ~M_BUZ_MASK;
M_BUZ_Data_ADDR = Port_1_SHADE;
//RED_LED_Data_ADDR &= ~RED_LED_MASK;
// Delay for user to perceive success/failure LED blink indicaiton.
//for(iDelayIndex = 0; iDelayIndex <30000; iDelayIndex++);
Delay10msTimes(100); //1 second delay;
//End the transmission
RadioEndTransmit();
return 1;
//RED_LED_Data_ADDR |= RED_LED_MASK;
}
//If transmit is not successful
else
{
Port_1_SHADE |= M_BUZ_MASK;
M_BUZ_Data_ADDR = Port_1_SHADE;
// GRN_LED_Data_ADDR &= ~GRN_LED_MASK;
// Delay for user to perceive success/failure LED blink indicaiton.
//for(iDelayIndex = 0; iDelayIndex <30000; iDelayIndex++);
Delay10msTimes(100); //1 second delay;
//End the transmission
RadioEndTransmit();
return 0;
// GRN_LED_Data_ADDR |= GRN_LED_MASK;
}
//End the transmission
// RadioEndTransmit();
//Generate a delay so that radio gets stabilized
//for(iDelayIndex = 0; iDelayIndex <30000; iDelayIndex++);
// Delay10msTimes(100);
}
unsigned char Call_RX(void)
{
//Defining a variable to store the recieved payload size of type RADIO_LENGTH
RADIO_LENGTH ReceivedPayloadSize;
//Defining a variable to store the receive state of type RADIO_STATE
RADIO_STATE RxState;
// Set the receive buffer
RadioSetPtr(RxPayloadBuffer);
//Receive packet length = PAYLOAD_LENGTH
RadioSetLength(PAYLOAD_LENGTH);
// Start the receiver
RadioStartReceive();
//Loop continuously
while(TRUE)
{
// Get the state of the receiver
RxState = RadioGetReceiveState();
//if Receive operation is complete
if (RxState & RADIO_COMPLETE)
{
//If no error in reception
if ((RxState & RADIO_ERROR) != RADIO_ERROR)
{
//End reception. Returns the payload size
ReceivedPayloadSize = RadioEndReceive();
M_RX_DATA = RxPayloadBuffer[0];
//Process the received data packets
//ProcessReceivedPacket(ReceivedPayloadSize, RxPayloadBuffer);
if (M_RX_DATA == S_ID )
{
Port_1_SHADE |= M_BUZ_MASK;
M_BUZ_Data_ADDR = Port_1_SHADE;
//M_BUZ_Data_ADDR =0x04;
//Generate a delay so that radio gets stabilized
//for(iDelayIndex = 0; iDelayIndex <30000; iDelayIndex++);
//Delay10msTimes(100);
//M_BUZ_Data_ADDR =0x00;
return 1;
}
else
{
return 0;
}
}
//If error in reception
else
{
//End the radio reception
RadioEndReceive();
//Abort the Radio operation
RadioAbort();
}
//Break from the loop
break;
}
}
return 0;
}
- Labels:
-
PSoC 1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
To do so use "Archive Project" from Designer's File-menu and upload the resulting archive here.
Bob (Permanently small window, despairing!)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Praveen
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I already complained with MyCase number 2190863051
A picture is attached there showing my problem.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Even a typo I pointed out to him does not get corrected. Seems to be a very busy man (busy with WHAT?)
Bob