2014-11-26 08:56 AM
Hello,
I try to set up a spirit1 device. I use your given Spiriti1 library and the example projects, but while radiInit, my device stuck everytime on the same point:SpiritCmdStrobeLockTx();
do{
SpiritRefreshStatus();
}while(g_xStatus.MC_STATE != MC_STATE_LOCK);
This piece of code is located in the
SpiritManagementWaVcoCalibration(void)
function (SPIRIT_Management.c), which gets called during
SpiritRadioInit(&radio);
Instead of going into lock state, the device remains in PM_setup state (0x3B). Do you now why the device behaves like this?
However, here is my SRadioInit config:
#define XTAL_FREQUENCY 52000000
#define SPIRIT_VERSION SPIRIT_VERSION_3_0
#define USE_MIDDLE_BAND
#define XTAL_OFFSET_PPM 0
#ifdef USE_VERY_LOW_BAND
#define BASE_FREQUENCY 0e6
#endif
#ifdef USE_LOW_BAND
#define BASE_FREQUENCY 0e6
#endif
#ifdef USE_MIDDLE_BAND
#define BASE_FREQUENCY 40e6
#endif
#ifdef USE_HIGH_BAND
#define BASE_FREQUENCY 80e6
#endif
#define CHANNEL_SPACE 20e3
#define CHANNEL_NUMBER 0
#define MODULATION_SELECT FSK
#define DATARATE 38400
#define FREQ_DEVIATION 20e3
#define BANDWIDTH 100E3
#define POWER_DBM 6
#define RSSI_THRESHOLD 0x20
/** SPIRIT Radio configuration struct */
static SRadioInit radio;
radio.nXtalOffsetPpm = XTAL_OFFSET_PPM;
radio.lFrequencyBase = BASE_FREQUENCY;
radio.nChannelSpace = CHANNEL_SPACE;
radio.cChannelNumber = CHANNEL_NUMBER;
radio.xModulationSelect = MODULATION_SELECT;
radio.lDatarate = DATARATE;
radio.lFreqDev = FREQ_DEVIATION;
radio.lBandwidth = BANDWIDTH;
#radioinit #lock #state #spirit1
2014-11-27 01:02 AM
Hello,
to be able to aswer to your question, we need more information, and to start:2014-11-27 04:21 AM
Hello,
Thank you for your answer. I'm using your Spirit1 chip and radio circuit from your eval board attached to my custom board. http://www.st.com/web/en/catalog/tools/PF253894 I'm working on 433MHz frequenzy and the I have Spirit eval boards with 50MHz or 52MHz crystal. The described problems happens with both crystal frequency. Best regards2014-11-27 05:37 AM
Hello,
do you call the following:SpiritRadioSetXtalFrequency(XTAL_FREQ); before radio init?(obviusly XTAL_FREQ is 50000000 or 52000000 according to your xtal).PS: http://www.st.com/web/en/catalog/tools/PF253894 links to a 315MHz board. Is this link correct, given that you are working at 433MHz?Regards,Gaetano2014-11-27 11:47 PM
Hello,
Yes, I do call SpiritRadioSetXtalFrequency(XTAL_FREQ); before init. and I change the XTAL_FREQ according to my crystal. The modulues working on 433Mhz, the according resistor is set. Here is my init code:void rfProtocolInit(void){
uint32_t i;
rf_protocol_state = Init;
//Resets Spirit1
SpiritEnterShutdown();
for(i=0;i<100000;i++);
SpiritExitShutdown();
for(i=0;i<100000;i++);
/** \brief SPIRIT Gpio configuration. */
gpio0.xSpiritGpioIO = SPIRIT_GPIO_0;
gpio0.xSpiritGpioMode = SPIRIT_GPIO_MODE_DIGITAL_OUTPUT_LP;
gpio0.xSpiritGpioPin = SPIRIT_GPIO_DIG_OUT_IRQ;
gpio1.xSpiritGpioIO = SPIRIT_GPIO_0;;
gpio1.xSpiritGpioMode = SPIRIT_GPIO_MODE_DIGITAL_OUTPUT_LP;
gpio1.xSpiritGpioPin = SPIRIT_GPIO_DIG_OUT_SYNC_DETECTED;
SpiritGpioInit(&gpio0);
SpiritGpioInit(&gpio1);
/** \brief SPIRIT Radio configuration */
radio.nXtalOffsetPpm = XTAL_OFFSET_PPM;
radio.lFrequencyBase = BASE_FREQUENCY;
radio.nChannelSpace = CHANNEL_SPACE;
radio.cChannelNumber = CHANNEL_NUMBER;
radio.xModulationSelect = MODULATION_SELECT;
radio.lDatarate = DATARATE;
radio.lFreqDev = FREQ_DEVIATION;
radio.lBandwidth = BANDWIDTH;
SpiritRadioSetXtalFrequency(XTAL_FREQUENCY);
SpiritRadioInit(&radio);
/** \brief SPIRIT package configuration */
packet.xPreambleLength = PKT_PREAMBLE_LENGTH_04BYTES;
packet.xSyncLength = PKT_SYNC_LENGTH_4BYTES;
packet.lSyncWords = 0xABCDEF;
packet.xFixVarLength = PKT_LENGTH_VAR;
packet.cPktLengthWidth = 6; //log2(MAXPAYLOADLENGTH+1) = log2(64) = 6
packet.xCrcMode = PKT_CRC_MODE_8BITS;
packet.xControlLength = PKT_CONTROL_LENGTH_0BYTES;
packet.xAddressField = S_DISABLE;
packet.xFec = S_DISABLE;
packet.xDataWhitening = S_DISABLE;
addresses.cBroadcastAddress = 255;
addresses.cMulticastAddress = 100;
addresses.cMyAddress = MyAddress;
addresses.xFilterOnBroadcastAddress = S_ENABLE;
addresses.xFilterOnMulticastAddress = S_DISABLE;
addresses.xFilterOnMyAddress = S_DISABLE;
SpiritPktBasicInit(&packet);
SpiritPktBasicAddressesInit(&addresses);
/** \brief SPIRIT IRQ configuration. */
spiritirq.IRQ_RX_DATA_READY = S_ENABLE;
SpiritIrqInit(&spiritirq);
}
and these are the definitions in the header file:
/** \brief Spirit tranceiver defines */
#define XTAL_FREQUENCY 52000000
#define SPIRIT_VERSION SPIRIT_VERSION_3_0
#define USE_MIDDLE_BAND
#define XTAL_OFFSET_PPM 0
#ifdef USE_VERY_LOW_BAND
#define BASE_FREQUENCY 0e6
#endif
#ifdef USE_LOW_BAND
#define BASE_FREQUENCY 0e6
#endif
#ifdef USE_MIDDLE_BAND
#define BASE_FREQUENCY 40e6
#endif
#ifdef USE_HIGH_BAND
#define BASE_FREQUENCY 80e6
#endif
#define CHANNEL_SPACE 20e3
#define CHANNEL_NUMBER 0
#define MODULATION_SELECT FSK
#define DATARATE 38400
#define FREQ_DEVIATION 20e3
#define BANDWIDTH 100E3
#define POWER_DBM 6
#define RSSI_THRESHOLD 0x20
/** SPIRIT Gpio configuration structs */
static SGpioInit gpio0, gpio1;
/** SPIRIT IRQ configuration struct */
static SpiritIrqs spiritirq = {0};
/** SPIRIT BasicPacket configuratuin struct */
static PktBasicInit packet;
static PktBasicAddressesInit addresses;
/** SPIRIT Radio configuration struct */
static SRadioInit radio;
Best regards
2014-11-28 06:46 AM
Hello,
we have used your code with our daughter board but the issue was not reproduced.Can you report the value of the registers f0 and f1?Regards,Gaetano2014-12-01 04:47 AM
Hello,
I've read all Spirit registers before radioInit() and on failure I read it again. Therefore it's possible to check the register access. I observed many data conversions and probably there it fails.. I'm checking this. Here is my report:Spirit Register Log
before init (status ready) while initRadio() fails
Reg Hex Dec Reg Hex Dec
00 0C 012 00 07 007
01 C0 192 01 40 064
02 A2 162 02 00 000
03 A2 162 03 A2 162
04 A2 162 04 A2 162
05 0A 010 05 0A 010
06 00 000 06 00 000
07 A3 163 07 31 049
08 0C 012 08 0C 012
09 84 132 09 7D 125
0A EC 236 0A 89 137
0B 51 081 0B CB 203
0C FC 252 0C 0D 013
0D A3 163 0D A3 163
0E 00 000 0E 00 000
0F 00 000 0F 00 000
10 03 003 10 03 003
11 0E 014 11 0E 014
12 1A 026 12 1A 026
13 25 037 13 25 037
14 35 053 14 35 053
15 40 064 15 40 064
16 4E 078 16 4E 078
17 00 000 17 00 000
18 07 007 18 07 007
19 00 000 19 00 000
1A 83 131 1A 83 131
1B 1A 026 1B 0A 010
1C 45 069 1C 45 069
1D 23 035 1D 23 035
1E 48 072 1E C8 200
1F 18 024 1F 00 000
20 25 037 20 25 037
21 E3 227 21 E3 227
22 24 036 22 24 036
23 58 088 23 58 088
24 22 034 24 22 034
25 62 098 25 62 098
26 8A 138 26 8A 138
27 05 005 27 05 005
28 00 000 28 00 000
29 00 000 29 00 000
2A 00 000 2A 00 000
2B 00 000 2B 00 000
2C 00 000 2C 00 000
2D 00 000 2D 00 000
2E 00 000 2E 00 000
2F 00 000 2F 00 000
30 00 000 30 00 000
31 07 007 31 07 007
32 1E 030 32 1E 030
33 20 032 33 20 032
34 00 000 34 00 000
35 14 020 35 14 020
36 88 136 36 88 136
37 88 136 37 88 136
38 88 136 38 88 136
39 88 136 39 88 136
3A 02 002 3A 02 002
3B 20 032 3B 20 032
3C 20 032 3C 20 032
3D 00 000 3D 00 000
3E 30 048 3E 30 048
3F 30 048 3F 30 048
40 30 048 40 30 048
41 30 048 41 30 048
42 00 000 42 00 000
43 00 000 43 00 000
44 00 000 44 00 000
45 00 000 45 00 000
46 00 000 46 00 000
47 00 000 47 00 000
48 00 000 48 00 000
49 00 000 49 00 000
4A 00 000 4A 00 000
4B 00 000 4B 00 000
4C 00 000 4C 00 000
4D 00 000 4D 00 000
4E 00 000 4E 00 000
4F 70 112 4F 70 112
50 02 002 50 02 002
51 00 000 51 00 000
52 08 008 52 08 008
53 01 001 53 01 001
54 00 000 54 00 000
55 01 001 55 01 001
56 00 000 56 00 000
57 01 001 57 01 001
58 00 000 58 00 000
59 03 003 59 03 003
5A 00 000 5A 00 000
5B 00 000 5B 00 000
5C 00 000 5C 00 000
5D 00 000 5D 00 000
5E 00 000 5E 00 000
5F 00 000 5F 00 000
60 00 000 60 00 000
61 00 000 61 00 000
62 00 000 62 00 000
63 00 000 63 00 000
64 FF 255 64 FF 255
65 00 000 65 00 000
66 04 004 66 04 004
67 00 000 67 00 000
68 00 000 68 00 000
69 00 000 69 00 000
6A 00 000 6A 00 000
6B 00 000 6B 00 000
6C 00 000 6C 00 000
6D 70 112 6D 00 000
6E 48 072 6E 48 072
6F 48 072 6F 48 072
70 00 000 70 00 000
71 00 000 71 00 000
72 00 000 72 00 000
73 00 000 73 00 000
74 00 000 74 00 000
75 00 000 75 00 000
76 00 000 76 00 000
77 00 000 77 00 000
78 00 000 78 07 007
79 00 000 79 00 000
7A 00 000 7A 00 000
7B 00 000 7B 00 000
7C 00 000 7C 00 000
7D 00 000 7D 00 000
7E 00 000 7E 00 000
7F 00 000 7F 00 000
80 00 000 80 00 000
81 00 000 81 00 000
82 00 000 82 00 000
83 00 000 83 00 000
84 00 000 84 00 000
85 00 000 85 00 000
86 00 000 86 00 000
87 00 000 87 00 000
88 00 000 88 00 000
89 00 000 89 00 000
8A 00 000 8A 00 000
8B 00 000 8B 00 000
8C 00 000 8C 00 000
8D 00 000 8D 00 000
8E 00 000 8E 00 000
8F 00 000 8F 00 000
90 00 000 90 00 000
91 00 000 91 00 000
92 00 000 92 00 000
93 00 000 93 00 000
94 00 000 94 00 000
95 05 005 95 05 005
96 E8 232 96 E8 232
97 37 055 97 37 055
98 08 008 98 08 008
99 08 008 99 08 008
9A F7 247 9A F7 247
9B 00 000 9B 00 000
9C 00 000 9C 00 000
9D 00 000 9D 00 000
9E 5B 091 9E DB 219
9F 20 032 9F 00 000
A0 34 052 A0 00 000
A1 11 017 A1 19 025
A2 D6 214 A2 00 000
A3 37 055 A3 35 053
A4 0C 012 A4 00 000
A5 20 032 A5 20 032
A6 00 000 A6 00 000
A7 E1 225 A7 E1 225
A8 00 000 A8 00 000
A9 01 001 A9 01 001
AA 02 002 AA 02 002
AB 28 040 AB 28 040
AC 05 005 AC 05 005
AD 83 131 AD 83 131
AE F5 245 AE F5 245
AF 00 000 AF 00 000
B0 08 008 B0 08 008
B1 00 000 B1 00 000
B2 42 066 B2 42 066
B3 00 000 B3 00 000
B4 21 033 B4 21 033
B5 10 016 B5 00 000
B6 FF 255 B6 FF 255
B7 00 000 B7 00 000
B8 01 001 B8 01 001
B9 00 000 B9 00 000
BA 03 003 BA 03 003
BB 03 003 BB 03 003
BC 04 004 BC 04 004
BD 00 000 BD 00 000
BE 00 000 BE 00 000
BF 00 000 BF 00 000
C0 02 002 C0 02 002
C1 07 007 C1 77 119
C2 00 000 C2 00 000
C3 00 000 C3 00 000
C4 00 000 C4 00 000
C5 00 000 C5 00 000
C6 00 000 C6 00 000
C7 00 000 C7 00 000
C8 00 000 C8 00 000
C9 00 000 C9 00 000
CA 00 000 CA 00 000
CB 00 000 CB 00 000
CC 00 000 CC 00 000
CD 00 000 CD 00 000
CE 00 000 CE 00 000
CF 00 000 CF 00 000
D0 00 000 D0 00 000
D1 00 000 D1 00 000
D2 00 000 D2 00 000
D3 00 000 D3 00 000
D4 00 000 D4 00 000
D5 00 000 D5 00 000
D6 00 000 D6 00 000
D7 00 000 D7 00 000
D8 00 000 D8 00 000
D9 00 000 D9 00 000
DA 00 000 DA 00 000
DB 00 000 DB 00 000
DC 00 000 DC 00 000
DD 00 000 DD 00 000
DE 00 000 DE 00 000
DF 00 000 DF 00 000
E0 00 000 E0 00 000
E1 00 000 E1 00 000
E2 00 000 E2 00 000
E3 00 000 E3 00 000
E4 70 112 E4 70 112
E5 00 000 E5 00 000
E6 00 000 E6 00 000
E7 00 000 E7 00 000
E8 00 000 E8 00 000
E9 00 000 E9 00 000
EA 00 000 EA 00 000
EB 00 000 EB 00 000
EC 00 000 EC 00 000
ED 00 000 ED 00 000
EE 00 000 EE 00 000
EF 00 000 EF 00 000
F0 01 001 F0 01 001
F1 30 048 F1 30 048
F2 00 000 F2 00 000
F3 00 000 F3 00 000
F4 00 000 F4 00 000
F5 00 000 F5 00 000
F6 00 000 F6 00 000
F7 00 000 F7 00 000
F8 00 000 F8 00 000
F9 00 000 F9 00 000
FA 00 000 FA 00 000
FB 00 000 FB 00 000
FC 00 000 FC 00 000
FD 00 000 FD 00 000
FE 00 000 FE 00 000
FF 00 000 FF 00 000
Do you see any definitely wrong data?
kind regards
2014-12-02 01:20 AM
Hello,
I don't see anything wrong in those registers values.The way we have reproduced your issue has been to use a board with a 26MHz crystal instead of the 52MHz one. Thus, a couple of question:- do you use the GUI to obtain the crystal frequency? If not, how do you obtain this info?- can you comment the call to the following function (at the end of the radioinit function):SpiritManagementWaVcoCalibrationand report what happens.Regards,Gaetano2014-12-02 08:14 AM
Hello,
I obtained the crystal frequency by reading the label with a magnifying glass, it's very small but readable. I commented the SpiritManagementWaVcoCalibration function as you wrote. In my library sources, this funtion gets called in SpiritRadioSetFrequencyBase function, which gets called at the end of radioInit. (SPIRIT_Radio.c / line944). Now the device finishes intialisation. Packet and address config works and it goes into ready state. After initialisation i tried getting into LockTX state. I called SpiritCommandStrobes(0x66) and the device stucks in 0x3B state. Do you have any ideas why this happens? Thank you Kind regards