Bare minimum required to drive RFM95 from STM32

Started by gorge, July 31, 2016, 09:43:02 PM

gorge

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?


//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

gorge

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

What type of hardware do you have? Ie what is your setup?

gorge

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

#4
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.

gorge

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/