STM32F3Discovery + CC1101 radio

Hi! I’m trying to get STM32F3discovery board to work with a cc1101 radio, and I’m getting an error while initializing it.

I’ve only included the necessary modules in the boards makefile + created the cc110x_params.h file with the appropriate setting.

The whole thing freezes up in the netdev2_cc110x_setup function. It goes for a while, then it calls cc110x_setup, and the first step is to initialize the CS gpio pin, so it calls gpio_init(dev->params.cs, GPIO_DIR_OUT, GPIO_NOPULL);

The error occures at this line: port->PUPDR |= (pushpull << (2 * pin_num)); I’ve ran a debugger an its seems that its trying to do a contexts switch. The GPIO test example works just fine I get this output on the serial console: What to do/where to go? I’ve just started using ARM MCUs. Here is the github repo: I’ve changed the stm32f3discovery in boards.


Thanks for the reply! I was using PIN3 originally, but I’ve tried a ton of other pins. They worked in the GPIO example. I’ve added an interrutpt disable before the gpio inits, it has the same error:

I forgot to mention that the debugger says that the CPU catched a hard fault exception.

I’ve solved the problem. The problem was in the cc110x gpio initialization. You should use:

const cc110x_params_t cc110x_params = { { .spi = 0, .cs = GPIO_PIN(0,3), .gdo0 = GPIO_PIN(0,0), .gdo1 = GPIO_PIN(0,6), .gdo2 = GPIO_PIN(0,2) }, }; instead of pure numbers.

I was able to reach the shell using the radio, but I have some questions. I have a CC1101, it seems to me that CC1100 is different, both are usable with the driver right? I’ve tried to make gnrc_networking example to work, using the instructions of Kapsar which I’ve found on this mail list:

1. create a file "cc110x_params.h" and put it in your board's include/
directory. See "boards/msba2/include/cc110x_params.h" as example. You
have to put the right parameters for your board.

2. Add these lines to your board's Makefile.include:

ifneq (,$(filter gnrc_netif_default,$(USEMODULE)))
    USEMODULE += cc110x gnrc_netdev2 gnrc_cc110x

3. Append these lines to Makefile.dep:

ifneq (,$(filter cc110x,$(USEMODULE)))
    DISABLE_MODULE += gnrc_sixlowpan_iphc

4. make clean all flash term ...

The next steps depend on whether your board has an implementation of
cpuid. Check that by typing "ifconfig" and see whether
"fe80::201:203:405:607/64" is every node's link-local address.
If they're different and unique, continue at step 6. Otherwise, manually
set new addresses:

5. on each node, enter these lines:

ifconfig 7 del fe80::201:203:405:607
ifconfig 7 set addr <n>
ifconfig 7 add fe80::<n>

(replace <n> with any hex number from 1 to fe)

After the nodes should be able to ping each other at fe80::<n>.

6. on one node, type:
udp server start 12345

7. on another node, type:
udp send <other-node-ip> 12345 TEST
(replace <other-node-ip> ...)

By the way I’m using this module using a simple 164 mm antenna made from an UTP cable wire in a breadboard, the module is also in the breadboard with ~10 cm wires.

The modified Makefile.dep is the one in the root folder.

I’ve also enabled debugging in the CC1101 driver files and added a small segment to the setup, which prints out the configuration/status registers, so I can see that the connection between the board and the radio works properly, and it does indeed. ifconfig tells me this:


-Iface 7 HWaddr: 20 Channel: 0

-MTU:1280 HL:64 6LO RTR IPHC

-Link type: wireless

-inet6 addr: ff02::1/128 scope: local [multicast]

-inet6 addr: fe80::3600:3400:757:3156/64 scope: local

-inet6 addr: ff02::1:ff57:3156/128 scope: local [multicast]

If I set the channel it says:

-ifconfig 7 set chan 8



-success: set channel on interface 7 to 8

But if I write in ifconfig again the “Channel” parameter stays on 0.

So I’ve continued with point number 5 with:

-ifconfig 7 del fe80::3600:3400:757:3156

-ifconfig 7 set addr 1

-ifconfig 7 add fe80::1

even though our adresses were different. I’ve tried this on different channels.

After this I’ve started the udp server with:

-udp server start 12345

After that I set up the other node similarly and write: -udp server start fe80::1 12345 TEST

And every type I try that then this appears on the first nodes terminal: -drivers/cc110x/cc110x.c:cc110x_switch_to_rx:157

This line also appears randomly sometimes.

I’ve also tried txtsnd 7 20 HELLO and txtsnd 7 fe80::2 HELLO with no success

This also appears in the console:


-cc110x: snd pkt to 0 payload_length=28

-cc110x_isr_handler() RADIO_TX_BUSY + GDO2

I’ve ran a debugger and it really sends something, but not a text apparently.

What am I missing? Thanks! Viktor