View previous topic :: View next topic |
Author |
Message |
klausdejong
Joined: 15 Nov 2004 Posts: 18
|
RFM23B |
Posted: Tue Nov 20, 2012 9:30 am |
|
|
I'm trying to get the HopeRF RFM23B to work. What is the SPI-mode to be used?
Regards,
Klaus de Jong |
|
|
crocu
Joined: 02 Nov 2009 Posts: 5
|
|
Posted: Tue Dec 25, 2012 4:55 am |
|
|
Hello
Would someone share a working project in order to send and receive with RFM22 modules ?
I did not find what SPI mode to use with these modules either, i did not find this information on the datasheet.
Many thanks for your help |
|
|
ckielstra
Joined: 18 Mar 2004 Posts: 3680 Location: The Netherlands
|
|
Posted: Tue Dec 25, 2012 6:38 am |
|
|
For determining the SPI mode I always use the following table: Code: | // SPI Mode | MOTOROLA | MICROCHIP | CCS | Clock line idle | Data clocked in at
//----------------------------------------------------------------|-----------------|-------------------
// | CPOL CPHA| CKP CKE | | |
// 0 | 0 0 | 0 1 | SPI_L_TO_H | SPI_XMIT_L_TO_H | low | low to high edge
// 1 | 0 1 | 0 0 | SPI_L_TO_H | low | high to low edge
// 2 | 1 0 | 1 1 | SPI_H_TO_L | high | high to low edge
// 3 | 1 1 | 1 0 | SPI_H_TO_L | SPI_XMIT_L_TO_H | high | low to high edge
//
#define SPI_MODE_0 (SPI_L_TO_H | SPI_XMIT_L_TO_H)
#define SPI_MODE_1 (SPI_L_TO_H)
#define SPI_MODE_2 (SPI_H_TO_L)
#define SPI_MODE_3 (SPI_H_TO_L | SPI_XMIT_L_TO_H)
// Example:
setup_spi(SPI_MASTER | SPI_MODE_0 | SPI_CLK_DIV_4 ); |
For the RFM22B and RFM23B look at Table 10 of the datasheet.
In idle the clock line is low. See table above, this means either SPI mode 0 or 1.
The data is clocked in at the rising edge, meaning SPI mode 0 or 3.
Both combined results in SPI mode 0 to be the correct one. |
|
|
crocu
Joined: 02 Nov 2009 Posts: 5
|
|
Posted: Tue Sep 10, 2013 4:19 am |
|
|
When trying to send a payload with RFM22b, i often (most of the time) get the module locked-up in transmit mode : nIRQ won't go low although the string has been sent.
Then module stays in TX mode and gets very hot quickly.
According to datasheet if nIRQ does not go low after TX process it means transmission is not working properly.
Normally module needs about 90ms to transmit a string, then nIRQ should go back to low.
I use the Fixpkt mode, as same as 'danr' does.
Can someone show me how to proceed to send a test string with RFM22b module please ?
Many thanks for your help, |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19538
|
|
Posted: Wed Sep 11, 2013 12:33 am |
|
|
So what do the status registers say is happening?.
Nirq, only says 'an even has occurred'. You need to read registers 3, and 4, to see 'what event'.
I'd suspect you have an error status being returned, not the packet sent status.
Best Wishes |
|
|
|