Author Topic: Bare minimum required to drive RFM95 from STM32  (Read 3577 times)

gorge

  • Newbie
  • *
  • Posts: 6
  • Country: au
Bare minimum required to drive RFM95 from STM32
« on: July 31, 2016, 09:43:02 PM »
Hi


I've been trying to get this module working but am having some trouble.
I'm not trying to do anything complicated. Just have it exit standby mode (which I assume is the default mode).
Then enter RX mode, and print whatever noise it manages to pick up (Just as a test).

So I'm leaving all values default and just changing the address register values that control the mode of operation which is 0x01 on the RFM95.

Is there anything wrong with my below code?


Code: [Select]
//Reset pin
HAL_GPIO_WritePin(GPIOH, GPIO_PIN_6, 0);
HAL_GPIO_WritePin(GPIOH, GPIO_PIN_6, 1);
HAL_GPIO_WritePin(GPIOH, GPIO_PIN_6, 0);

//Chip select pin pull down initially
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_15, 0);


//aTxBuffer is the data to be transmitted
//Send via SPI the register address to be written to
 aTxBuffer =  0x01 | 0x80;
HAL_SPI_Transmit(&SpiHandle,&aTxBuffer, 8, 5000);
//Send via SPI the value to write to the previously sent register address
aTxBuffer = 0x05;
HAL_SPI_Transmit(&SpiHandle,&aTxBuffer, 8, 5000);
//Chip select pin high
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_15, 1);
HAL_Delay(5000);
//Chip select pin low
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_15, 0);
//Enter standby mode in preparation for receive
 aTxBuffer =  0x01 | 0x80;
HAL_SPI_Transmit(&SpiHandle,&aTxBuffer, 8, 5000);
aTxBuffer = 0x01;
HAL_SPI_Transmit(&SpiHandle,&aTxBuffer, 8, 5000);
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_15, 1);
//Standby mode has been entered

//Now receive
« Last Edit: August 04, 2016, 09:19:05 AM by Felix »

gorge

  • Newbie
  • *
  • Posts: 6
  • Country: au
Re: Bare minimum required to drive RFM95
« Reply #1 on: August 01, 2016, 01:55:07 PM »
I think I have it working now but I'm receiving only zeros. Having said that, I haven't set up anything to transmit.

Would it be expected that you'd at least pick up the occasional non-zero value due to external noise?

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6403
  • Country: us
    • LowPowerLab
Re: Bare minimum required to drive RFM95
« Reply #2 on: August 01, 2016, 04:05:56 PM »
What type of hardware do you have? Ie what is your setup?

gorge

  • Newbie
  • *
  • Posts: 6
  • Country: au
Re: Bare minimum required to drive RFM95
« Reply #3 on: August 02, 2016, 11:34:01 PM »
STM32. I have it working now. I needed a small delay after putting the Module into RX mode. I am seeing lots of noise. Now that I'm running a 2nd chip to do transmitting, I want to ignore all that external interference. How do I do that?

gorge

  • Newbie
  • *
  • Posts: 6
  • Country: au
Re: Bare minimum required to drive RFM95 from STM32
« Reply #4 on: August 04, 2016, 12:24:42 AM »
I also had another question in my above post, so the topic isn't solved yet. Also, anyone can chime in, as my question isn't specific to STM32.
« Last Edit: August 04, 2016, 09:18:55 AM by Felix »

gorge

  • Newbie
  • *
  • Posts: 6
  • Country: au
Re: Bare minimum required to drive RFM95 from STM32
« Reply #5 on: August 04, 2016, 07:17:52 PM »
I found this thread which seems to be relevant to my interests. I guess I have no choice but to try to get an already implemented library working
https://lowpowerlab.com/forum/rf-range-antennas-rfm69-library/rfm69-rx-configuration/