Hallo, ich versuche nun schon seit geraumer Zeit diese Kombination zum Laufen zu bringen. Als Grundlage habe ich mir die Sparkfun Si4703 Library für Arduino genommen und etwas umgeschrieben für den STM32: https://github.com/sparkfun/SparkFun_Si4703_Arduino_Library Nun ergibt sich ein Problem welches ich überhaupt nicht nachvollziehen kann: Das Radiomodul läuft nur wenn ich an einer ganz bestimmten Stelle ein Breakpoint in den Code einfüge und das Programm dann durch manuelles anklicken weiterlaufen lasse. Wenn ich den Code einfach ohne Debugfunktion auf dem STM32 lade funktioniert das Radiomodul nicht. in der Main routine rufe ich einmal si4703_init(); auf zum initialisieren des Si4703. Hier der Code für den Si4703 Der besagte Breakpoint befindet sich am Ende der readRegisters() Funktion.
1 | //Read the entire register control set from 0x00 to 0x0F
|
2 | void readRegisters(){ |
3 | |
4 | unsigned char inBuff[32]; |
5 | |
6 | HAL_I2C_Master_Receive(&hi2c3, SI4703, inBuff, 32, 100); |
7 | |
8 | //Si4703 begins reading from register upper register of 0x0A and reads to 0x0F, then loops to 0x00.
|
9 | //Wire.requestFrom(SI4703, 32); //We want to read the entire register set from 0x0A to 0x09 = 32 bytes.
|
10 | |
11 | //while(Wire.available() < 32) ; //Wait for 16 words/32 bytes to come back from slave I2C device
|
12 | //We may want some time-out error here
|
13 | |
14 | //Remember, register 0x0A comes in first so we have to shuffle the array around a bit
|
15 | unsigned char i = 0; |
16 | |
17 | for(int x = 0x0A ; ; x++) { //Read in these 32 bytes |
18 | if(x == 0x10) x = 0; //Loop back to zero |
19 | si4703_registers[x] = inBuff[i] << 8; |
20 | i++; |
21 | si4703_registers[x] |= inBuff[i]; |
22 | i++; |
23 | if(x == 0x09) break; //We're done! |
24 | }
|
25 | } //<<<< wenn hier durch Breakpoint gestoppt wird und anschließend weitergelaufen lassen wird funktioniert das Radiomodul |
26 | |
27 | //Write the current 9 control registers (0x02 to 0x07) to the Si4703
|
28 | //It's a little weird, you don't write an I2C addres
|
29 | //The Si4703 assumes you are writing to 0x02 first, then increments
|