Picaxe 08M serial problems

phib3r_0ptik

New Member
Hi,
I am in the process of making a project that involves communicating with an iPod from a picaxe 08M.
I have successfully made an interface, which works with my computer, and an AVR. I am now trying to get it to work with the picaxe. It requires a 9600 baud rate, then hexdecimal commands. I am using the following code:
setfreq m8
pause 900
sertxd($FF, $55, $03, $02, $00, $01, $FA)
sertxd($FF, $55, $03, $02, $00, $00, $FB)

When I connect it to a serial terminal (on the computer) it transmits identical signals to the AVR and the computer, but when I connect it to the iPod nothing happens. I have double-checked the connections, and tried connecting the AVR in place of the Picaxe, which works fine. When I put an LED across the TX and GND it blinked for both the AVR and the Picaxe, but I noticed that it was less bright from the picaxe. I have a feeling this could be related to the problem, but as I do not have a lot of experience with this, or proper testing equipment (no oscilloscope :()
Does anyone have any suggestions or advice on how to get it to work?

Any help would be greatly appreciated. Thanks.
 

hippy

Ex-Staff (retired)
Are you running the PICAXE from the same voltage as you did the AVR ? Is there some difference with the output drive from each ? Were they both direct output pin to iPod connections or something more ? Could it be inverted signal polarity ? It could be that the 08M frequency is slightly out and needs tweaking with CALIBFREQ but I recall Technical saying iPod auto-calibrates baud so that shouldn't matter.

With a scope you could monitor what the AVR puts into the iPod and see the same for the PICAXE and likely have an instant answer. As it is, we're left trying to guess what the problems may be, and I have no idea what the iPod interface or signal levels/polarities should be.
 

phib3r_0ptik

New Member
I am running both the AVR and the Picaxe off a regulated 5v power supply.
There is a little circuitry required to get the iPod to enter serial mode, but the RX and GND are just directly connected to the computer/avr/picaxe TX and gnd pins.
I don't have access to a 'scope, so I will not be able to use that to troubleshoot.
The iPod does seem to automatically callibrate the baud rate, as it automatically switches between and recognises when I change between 19200 baud and 9600 bauds from the AVR.

Thanks anyway for your help.
 

Technical

Technical Support
Staff member
settxd is inverted "n" baud rate polarity (active low pulsing high)
ipod wants "t" (active high pulsing low) so on 08M use serout 0,t2400, not sertxd

The baud rate is almost irrelevant, as the ipod self calibrates from the FF 55 header (neat trick).

Make sure you have 500k (ish) pull down on pin 21. We use 470k fine.

This works on mini and nano using a 14M (9600 at 8MHz). Note short delay between button down and buttun up command.

Code:
; iPod controller
; Using AXE117 Project board and Podbreakout board
; Connections
; iPod Podbreakout  PICAXE-14M on AXE117
; Txd  12   Input0
; Rxd  13   Output5 (via 10k/22k divider to give 3.3V)
; Gnd  1   0V
; Also link pin 15 (GND) to pin 21 of Podbreakout with 470k resistor
;  - this puts iPod into serial mode
 
; Simple test routine should switch between play and pause every 2 seconds
 #picaxe 14m
init:
 high 5
 pause 10
 setfreq m8
 
main:
 serout 5,t4800,($FF,$55,$03,$02,$00,$01,$FA) ' send play/pause
 pause 24       ' wait 12 ms
 serout 5,t4800,($FF,$55,$03,$02,$00,$00,$FB) ' send button up
pause 4000       ' wait 2 seconds
goto main
 

phib3r_0ptik

New Member
Thanks,
I have tried this with my 08M, but it did not work. I was under the impression that although the iPod automatically callibrated the baud rate, the minimum was 9600, so if I use serout 0,t2400, with the iPod overclocked to 8mhz, it will still only transmit at 4800 baud rate. I have tried with the AVR, and it will work at 9600, but no lower then 9500. It will work at high baud rates (over 19200), but not below 9600.
As far as I am aware the 08M cannot transmit using serout, over 4800. Is this correct?
If so, what picaxe would you recommend me using instead? All I need to be able to do is recieve IR, output to 3 pins, and transmit to the iPod. Would a 14M (if I can get one) be my best option?
 

BCJKiwi

Senior Member
Take another look at Manual2 page144.
This clearly shows, that with a clock speed of 8MHz, serout on the 08M will be at 9600 baud.
 
Last edited:

phib3r_0ptik

New Member
Take another look at Manual2 page144.
This clearly shows, that with a clock speed of 8MHz, serout on the 08M will be at 9600 baud.
What?
Sorry I do not understand. For the 08M, you can use a maximum of 2400 for serout ( serout 0,t2400, ), if you use higher it will not compile Note that the 4800 baud rate is only available on the X parts., (picaxe manual section 2 page 144). The default clock of the 08M is 4mhz, if you increase that to 8mhz the serial data speed will double, so it will now be outputting at 4800 baud rate wont it?
I dont quite see what you mean about the manual, where does it state that?

Sorry about my confusion, but I really do not understand what you mean. :confused:
 
Top