HM-TR/232 Help

kamilan

Member
I have a 08M PICAXE and two HopeRF HM-TR/232 Transceivers.

I managed to connect the two transceivers to the PC via RS232 cable and set both chips to Default settings

433 Band
434 Frequency
Crystal Load Cap 12pF
+/-90kHz
PA Level 0dBm
RX Bandwidth 134kHz

I've tried to set up serial comms with two pic chips using the 08M development boards. Here is my code.

****************************Transmitter*********************
init: 'V+ - VCC - 5V
'0V - DTX - Data output to PICAXE
'0V - GND - GROUND
'0 - RTX - Data input from PICAXE
'1 - CONFIG - Set HIGH for CONFIG MODE // LOW to NORMAL MODE
'2 - ENABLE - Set HIGH to ENABLE CHIP // LOW to DISABLE CHIP
'3 - N/A
'4 - N/A
'V+ - N/A
'0V - N/A
HIGH 2
LOW 1

SerialOut: serout 0, N2400, ("HELLO",$D)
LOW 0
PAUSE 1000
goto SerialOut

****************************Receiver***********************
init: 'setfreq m8

'V+ - N/A
'0V - N/A
'0V - N/A
'0 - ENABLE - Set HIGH to ENABLE CHIP // LOW to DISABLE CHIPRTX
'1 - CONFIG - Set HIGH for CONFIG MODE // LOW to NORMAL MODE
'2 - Data input from PICAXE
'3 - Wired to Ground
'4 - DTX - Data output to PICAXE
'V+ - VCC - 5V
'0V - Wired to 3

HIGH 0
LOW 1

SerialIn: HIGH 0
pause 100
serin 4, T2400, ("HELLO",$D)
HIGH 2
PAUSE 1000
LOW 2
PAUSE 1000
goto SerialIn

The red LED on the HM-TR/232 Module flashes on the transmitter PICAXE and the green LED flashes on HM-TR/232 Module, but the PICAXE doesn't seem to follow through with the code and make PIN2 High.

Any suggestions?

Cheers

K
 

kamilan

Member
Baaaaaaaaaaaah!!!!

I can't believe I missed that LOL

I'll post an update tomorrow when I'm on campus to let you know if it work.
 

moxhamj

New Member
It will work, especially if the lights are already flashing on the modules. BTW you could leave out the LOW 0 on the Tx as serout leaves the pin at the correct high or low value depending on T or N polarity. So that saves a little bit of code.
 

kamilan

Member
Dr Acula, the symptoms are different....

Ok,

So I adjusted the polarity of the Baud rate. The PICAXE refuses to function. I used a wire to transmit and plugged it into input 4 on the O8M and it still doesn't work.

Instead of using PIN4 I decided to use PIN1 and a wire to transmit the serial information. And the code worked. I'm not to sure why this is, but as I understand it, PIN4 is either an input, output or ADC.

There could be a few reasons that my code doesn't work. Firstly though, the HM-TR is a confusing chip. Are the following pin descriptions correct??

ENABLE - This pin must be set HIGH in order for the module to operate in normal operation mode were it can be used as a receiver or transmitter.

CONFIG - This pin must be set to LOW in order for the module to operate in normal operation mode were it can be used as a receiver or transmitter.

DRX - This pin is used to transmit data. In terms of the PICAXE , the SEROUT command is used to output data FROM a PICAXE TO the HF-TR module, where the data is then transmitted.

GND - This pin is connected to a common GROUND of the PICAXE

RTX - This pin is used to receive data. In terms of the PICAXE, the SERIN command is used to receive data FROM the HF-TR module TO the PICAXE , where the data is then used in code.

VCC - This pin is connected to a common or separate Voltage supply.

Are these pin definitions correct? If not, that could be a reason why the code does not work.

Any idea of what the LEDs means on the HF-TR module. i.e. Red means transmit, Green means receive?

Lastly, PIN4 could be faulty on the picaxe chip. I will proceed with examining the board, and swapping out the 08M for another chip to see what happens.

Cheers

K
 

kamilan

Member
Solution

Hello,

For some reason, PIN4 on my board is faulty, and loves to pull HIGH every so often making it impossible to use as a SERIN.

I rewired it to used PIN3. Then to no success.

***THE SOLUTION***

I noticed that if you connect an oscilloscope to DTX, the voltages ran from +9V to -9V. This was no use to me.

I added a 22K resistor to PIN3 and then and 10K to Ground from PIN3 a per the PICAXE Manual 1 PDF - Serial Download Circuit. Once connected, and a few alterations to the code... SUCCESS!!!

Here is my code and pin layouts for those wanting a some test CODE to get their HM-TR/232 working.

'****************************Transmitter*********************
'V+ - VCC - 5V
'0V - DTX - Data output to PICAXE
'0V - GND - GROUND
'0 - RTX - Data input from PICAXE
'1 - CONFIG - Set HIGH for CONFIG MODE // LOW to NORMAL MODE
'2 - ENABLE - Set HIGH for Normal Operation // Set LOW to Sleep
'3 - N/A
'4 - N/A
'V+ - N/A
'0V - N/A

init: setfreq m8
HIGH 2
LOW 1

SerialOut: if pin3 = 1 then
serout 0, N2400, ($D)
LOW 0
goto SerialOut
Endif
goto SerialOut

'****************************Reveiver*********************

'V+ - N/A
'0V - N/A
'0V - N/A
'0 - ENABLE - Set HIGH for Normal Operation // Set LOW to Sleep
'1 - CONFIG - Set HIGH for CONFIG MODE // LOW to NORMAL MODE
'2 - Wired to GREEN LED - ( Normally RTX - Data to be outputted from PICAXE )
'3 - Wired to Ground
'4 - Wired to PIN3 - RDX - Data received from transmitter outputted to PICAXE
'V+ - VCC - 5V
'0V - Wired to PIN3

init: setfreq m8
HIGH 0
LOW 1

SerialIn: low 2
serin 3, N2400, ($D)
high 2
pause 1000
goto SerialIn
 

moxhamj

New Member
Ah - I think I know what has happened. There are in fact two versions of the RF modules, a TTL version which outputs 0V/5V and a RS232 version which outputs -9 and +9V. I think you have the latter. (which has a max232 chip surface mount on the board).

In which case the -9V has probably zapped pin 4.

So - the simple answer is to use the 22k/10k as you have found. Or order the modules that don't have the max232 chip (though you then need a max232 to program the module via the serial port).

Another solution is to use a max232 on the picaxe side. It depends if it is one circuit with the same power supply or two seperate circuits. I've been using a lot of different RF modules and sometimes like to mix and match with picaxe modules. If you connect a picaxe to an RF module with -9V coming out of it and no power supply on the picaxe it can zap the picaxe. So to make things safe I go picaxe=>max232=>D9 connector=>D9 connector=> RF module with max232. This of course uses more components than a 10k/22k. But the advantage is that every module and every picaxe board I build has a standard D9 plug/socket and I know that no matter what order I plug things in, or whether I forget to power one board up, it won't zap things.

I guess it is worth mentioning that you are driving N polarity into a module with 0V and 5V. You will get away with this most of the time as the max232 can handle this. But the technical specification of RS232 has voltages less than -3V or greater than +3V, and 0V is not actually a recognised signal level. But so many devices accept 0V that it probably isn't worth worrying about.

Great to hear it is working.
 
Last edited:

manuka

Senior Member
Kamilan: It's all really my fault for discovering these units, but the good Dr_A has pretty well nailed your problems. Yes- Hope's "Chinglish" is something I cringe about too.

I'll put in a plug for the TTL HopeRF transceivers, as these can be config. simply & idle at attractively low currents. See my resource site =>http://picaxe.orconhosting.net.nz/hoperf.htm Stan
 
Top