Other Parts Discussed in Thread: CC1120
Hi,
I have two CC1120 modules:
- fisrt one identified in smartRF studio with rev # 2.1
- the second identified in smartRF studio with rev # 2.3 and it has addtional note on its sticker "for Evaluation only; Not FCC approved..."
while trying to send a simple packet using perl script the CC1120 rev. 2.1 works fine and all packets receievd on but when I'm using the CC1120 rev. 2.3 I get nothing
is there any change in Perl commands i'm not aware of?
can someone explain what is the issue or help ,me find a solution?
Thanks.
Here's the perl script i'm using:
#!c:/Perl/bin/perl.exe
# *****************************************************************************
#
# File: dal_send.pl
#
# Brief: This script emulates the Packet TX function in SmartRF Studio.
#
# *****************************************************************************
#
use dal_eb;
# This script works AS IS with all IEEE 802.15.4 compatible devices. To use it
# with other RF devices, you must include a file that contains the register
# settings you want to use (uncomment the line below, and adapt the file to your
# needs). Register settings files can be generated by SmartRF Studio 7, Device
# Control Panel -> Register Export. Select PERL as template, and export to the
# file you want to use with this script (default dal_registers.pl).
#
require "CC1120.pl";
my $Packet = @ARGV[0];
my $F2 = @ARGV[1];
my $F1 = @ARGV[2];
my $F0 = @ARGV[3];
my $Power = @ARGV[4];
my $amount = @ARGV[5];
my $Interval = @ARGV[6];
my $HexPacket = $Packet;
$HexPacket =~ s/(.)/sprintf("%x",ord($1))/eg;
print "The Packet is $Packet $HexPacket\n";
print "The Frequancy is $F2$F1$F0\n";
print "The Power is $Power dBm\n";
print "The Interval is $Interval mSec\n";
# Start application
my $dal= new dal_ext::DALExt(); # Create DAL object
my $status= $dal->getStatus();
print "DAL creation status: $status\n";
die unless $status eq 0;
# Select the EB that will act as transmitter (index in enumeration list). The list
# is ordered by USB Device ID (ascending order).
my $ebDevIndex = 0;
my $packetInterval = 1; # Second
# Enumerate devices
$devicename= &DalEb::deviceEnum($dal,$ebDevIndex);
if ($devicename)
{
# A device is found at the requested EB index
$dev= new dal_ext::DALExtDevice($devicename);
print $dal->getErrorMessage() . "\n";
die unless &DalEb::connectEB($dev,$ebDevIndex) eq 0;
# Using custom register settings
writeRegisters($dev, $F2, $F1, $F0) if $fRegsDefined;
$dev->writeRegister("PA_CFG2", $Power);
# Place RF device in TX mode
print "$ebDevIndex: TX enable ";
$dev->setRegPacketTx();
die "Init TX failed" unless $dev->initTx() eq 0;
print "OK\n";
# my $regname = "PA_CFG2";
# $value = $dev->readRegister($regname);
# print "MARCSTATE = $value\n";
if ($devicename eq "CC1200")
{
# Make sure it is in IDLE state
my $regname = "MARCSTATE";
my $value = 0;
my $count = 0;
while (($value != 65) && ($count < 100))
{
$value = $dev->readRegister($regname);
print "MARCSTATE = $value\n";
$count++;
}
die "Device not in IDLE state." unless $count < 100;
}
my $regname = "PA_CFG2";
$value = $dev->readRegister($regname);
print "PA_CFG2 = $value requested $Power\n\n";
$dev->setPktInterval($Interval);
# Start packet transmission
my $i= 0;
while ($i<$amount)
{
print "$ebDevIndex: send #$i $Packet ...\n";
#$buf= $dev->sendPacket($Packet,0);
$buf= $dev->sendPacket($HexPacket,0);
$i++;
}
$dev->DESTROY();
}
$dal->DESTROY();