1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

XBOX Remote Control

Discussion in 'Microcontrollers' started by gregmcc, Jul 18, 2006.

  1. gregmcc

    gregmcc Member

    Joined:
    Aug 20, 2005
    Messages:
    303
    Likes:
    0
    Location:
    Darwen, UK
    Cool - thanks for the pictures and code.

    if I don't have the calibration value does it mean my PIC is useless.
    I'm going to build another programmer tonight and just double check everything - from Nigels post above on the Vdd it sounds like I need to use another programmer. I'm going to try the P16PRO. Im also going to buy another 12f675 incase my current ones are toast.

    The only thing is I'm scared if I program it and then try and reflash it, it will end up like the current ones I have.

    BTW I've been using micochips IDE to compile the code and the wisp628 and BumbleBee to write the code to the PIC.
     
  2. Nigel Goodwin

    Nigel Goodwin Super Moderator Most Helpful Member

    Joined:
    Nov 17, 2003
    Messages:
    39,324
    Likes:
    653
    Location:
    Derbyshire, UK
    Your programmer software should have saved and restored the calibration values - it's part of the programming specification. If it's lost you can always try and find out what it should be, there's even a technical bulletin at MicroChip that suggests how to do it!.

    But even without it the chip still works, it just means the internal oscillator is less accurate than it might be.

    It's not a problem with the PIC's, just your programmer - both WinPicProg and IC-Prog will program them fine with suitable hardware - including the ones you already have!.
     
  3. gregmcc

    gregmcc Member

    Joined:
    Aug 20, 2005
    Messages:
    303
    Likes:
    0
    Location:
    Darwen, UK
    Thanks. At least I dont have to buy more pics :) I'll build another programmer tonight and let you all know how it goes.

    I'll also take a look on the Microchips site for the info.
     
  4. dave

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    -
    Likes:
    0


     
  5. Matt(Pic progger)

    Matt(Pic progger) Member

    Joined:
    Apr 29, 2004
    Messages:
    147
    Likes:
    0
    Location:
    UK

    Hello again Greg, as Nigel says, there will be no problem with your PIC's the worst that can happen is that the calibration value will be lost, if you have access to a scope, then finding an accurate calibration is very easy, and if not then a pretty near value can be found ;)

    I have only come across this problem with the Picstart programmer, and it's a rare thing, so please don't panic! ;)

    btw, did u short pin 6 to ground with the chip removed? did your xbox boot? if not then you will need to sort this problem before the chip will work.

    I hope this helps
     
  6. gregmcc

    gregmcc Member

    Joined:
    Aug 20, 2005
    Messages:
    303
    Likes:
    0
    Location:
    Darwen, UK
    Matt,

    I've got a scope and downloaded the document from microchip of recalibrating it. Will try it out tonight. Then I need to build a decent programmer. My current one doesn't want to reprogram the chips - going to have a fun filled weekend :)

    At the moment the chip is on my breadboard. I want to get it working before I put it into the xbox - thats the last thing I feel like destroying now :)
     
  7. gregmcc

    gregmcc Member

    Joined:
    Aug 20, 2005
    Messages:
    303
    Likes:
    0
    Location:
    Darwen, UK
    Matt,

    On the weekend I built another programmer - the propic2. After putting some of the transistors the wrong way round I finally figured it out and now the programmer works and I can successfully program/erase/reprogram the 12f675 (The 16f628 on the other hand doesnt want to flash - but that is another issue)

    I've programmed the latest xbox hex you posted and put the chip in the circuit. When powering on nothing happens, the LED doesnt flash when I press any buttons on the remote. I thought maybe the PICs were blown so I programmed the blink LED code and it flashes away. Reflashed the latest code - same story.

    I then tried to reflash the 1.0 code posted earlier. The LED now flashes when I press button on the remote. Is there something I'm missing in the 1.1 code?

    I've also recompiled the 1.1 code - thought maybe the HEX was corrupt. No go.
     
  8. david_1

    david_1 New Member

    Joined:
    Jul 20, 2006
    Messages:
    8
    Likes:
    0

    ok so there is no problem with code but there is a problem with your chip :)

    in the first version of code the osscal val is not used but a movlw 'ac' I think
    this is not correct for your chip so the timming is off.
    in the second version osscal is used(check it first few lines after org 0) but your chip has its osscal value errased so you need to calibrate the chip by writeing to code to output a square wave and time it with the scope or guess at the value needed in osscal( not a good plan).

    when you get it to work the led will flash when push any button but stay on for five secs when you push display.

    David
     
  9. Exo

    Exo Active Member

    Joined:
    Sep 18, 2003
    Messages:
    1,953
    Likes:
    1
    Location:
    Belgium

    I've never had problems reprogramming a device that's running on INTOSC wich has a permanent power supply..
    What i know for sure causing a problem is the MCLR multiplexer, if you have a device with internal oscillator and you can use MCLR as a input pin, wich means that MCLR gets disconnected from the pin when the device starts up, leaving no way for your 14V programming voltage to reach MCLR.

    You can kill your pic with this, because the input pin that replaces MCLR does't like that 14 V if you try to program it.
     
  10. Nigel Goodwin

    Nigel Goodwin Super Moderator Most Helpful Member

    Joined:
    Nov 17, 2003
    Messages:
    39,324
    Likes:
    653
    Location:
    Derbyshire, UK
    To switch a PIC in to programming mode you must switch the MCLR pin to 13V or so, BEFORE the oscillator can start running. The simplest way is to switch Vdd as well as Vpp, set Vdd to 5V then immediately set Vpp to 13V, if you don't do it fast enough then it doesn't work. Assuming you can't switch Vdd?, as on some cheap and nasty programmers, you have another option - leave Vdd ON (as you can't alter it) but take MCLR LOW, to force the PIC into reset - then immediately take it to 13V to enter programming mode.

    If the PIC has been programmed to use MCLR as an I/O pin then this second method can't be used (because it's no longer a reset pin), and it obviously requires a programmer specifically designed to allow MCLR to be switched in this way.
     
  11. Exo

    Exo Active Member

    Joined:
    Sep 18, 2003
    Messages:
    1,953
    Likes:
    1
    Location:
    Belgium
    That must be why it always works for me then :)
    Probably my programming software does this.
     
  12. gregmcc

    gregmcc Member

    Joined:
    Aug 20, 2005
    Messages:
    303
    Likes:
    0
    Location:
    Darwen, UK
    David - Thanks. I'll try and recalibate my PICs tonight and let you know how things go.

    Nigel - That might explains why the 16Fxxx doesnt work :) What programmer would you recommend. I've tried the propic2 and dont seem to having any luck with the 16Fxxx. Before that I tried the Olimex PG3B programmer. Its the one that started off all the problems with the oscillator calibration value when I programmed in the XBOX code.

    Is there a decent DIY programmer that works with 12f675 and the 16f628? :)
     
  13. Exo

    Exo Active Member

    Joined:
    Sep 18, 2003
    Messages:
    1,953
    Likes:
    1
    Location:
    Belgium
  14. david_1

    david_1 New Member

    Joined:
    Jul 20, 2006
    Messages:
    8
    Likes:
    0
    File Type: zip Xbox Remote V1-1.zip (39.2 KB, 5 views)

    I test this today and it works fine

    David
     
  15. gregmcc

    gregmcc Member

    Joined:
    Aug 20, 2005
    Messages:
    303
    Likes:
    0
    Location:
    Darwen, UK
    David,

    I finally got my programmer working fine and have recalibrated my PICs. I am still having problems getting the code to work.

    How accurate does the oscillator have to be? Maybe my calibration tuning is not 100%.

    If I press any key on the keypad the LED flashes. If press the display button there's no pulse on the GP1 line
     
  16. david_1

    david_1 New Member

    Joined:
    Jul 20, 2006
    Messages:
    8
    Likes:
    0
    you may not see the pulse but you will see the led stay on for five seconds each time you press the display button. I think you may have to buy a new chip to prove that you recalibrated the old one right.

    any ir device pointed at the detector should make the led pulse in simpathy with ir data in fact if you hook a scope up the same data going in GP4 should be seen on GP5 untill it receives the write bit of IR. It took quite some time to work out what the ir data was but its is in the code for all the buttons you will have to just follow it through.

    David
     
    Last edited: Jul 26, 2006
  17. gregmcc

    gregmcc Member

    Joined:
    Aug 20, 2005
    Messages:
    303
    Likes:
    0
    Location:
    Darwen, UK
    thanks - I have hooked a scope up and do see the same data. Looks like I'll have to get another PIC and try my luck. I've got 3 uncalibrated ones now - pity I didnt know about the OSCCAL before I started fiddeling :(
     
  18. Matt(Pic progger)

    Matt(Pic progger) Member

    Joined:
    Apr 29, 2004
    Messages:
    147
    Likes:
    0
    Location:
    UK
    OK, if you have a scope, a way of setting the calibration is to use this code....

    __CONFIG _CP_OFF & _WDT_OFF & _BODEN_OFF & _PWRTE_OFF & _INTRC_OSC_CLKOUT & _MCLRE_OFF & _CPD_OFF


    BANK1 ; BANK1
    MOVLW H'XX' ; SET CALIBRATION VALUE AT A VALUE ('XX')
    MOVWF OSCCAL ; LOAD IN TO OSC CALIBRATION REG

    TEST
    GOTO TEST ;LOOP FOREVER

    Set value for your calibration (the H'XX' part) at a start value say H'40' (centre frequency), the data sheet is a bit weird here, they show the calibration value as 8bit's, CAL5->CAL0 then the lower 2 bits blank, and the description below as only 6 bits i.e. B'100000', there may be an errata for this oversite.... anyway..... check with your scope on pin3, you should see exactly 1uS pulses, if not, then reduce or increase your 'XX' value, by 4 (bottom 2 bits not used) accordingly.

    I suppose a frequency counter, if you have one could also be used, if so then you are looking for the nearset you can get to 1Mhz.

    When you have found your OSCCAL value, you need to program the data H"34XX" (were 'XX' is the value you have found, into location H"3FFF". You can do this, as mentioned in a previous post by programing the part as a larger chip, the programming will probably fail, but on reading the chip back you should see the your value (H'34XX', were 'XX' is your value) at H"3FFF".

    If 1uS is too small a value to read accuratly with your scope then simply fit a delay into the above code and toggle an IO pin ;)

    set pin
    wait 100uS
    clear pin
    wait 98uS (2uS to loop)
    loop

    It's a lot quicker to do.. than explain!

    If you want to get really fancy you could write some code to check buttons, increase/decrease your temp value by 4, and store the result into the eeprom, you would then only need to read the eeprom on a programmer, and you would have your value, if you do this code, maybe you could post it?

    Anyway, I hope this helps and that you can use your xbox soon!
     
    Last edited: Jul 27, 2006
  19. gregmcc

    gregmcc Member

    Joined:
    Aug 20, 2005
    Messages:
    303
    Likes:
    0
    Location:
    Darwen, UK
    Matt,

    Thanks for the explanation. I bought another pic and this time written down the osccal value. :) I've now reprogrammed the pic with the code and I'm still having the same problem :(

    I guess I must just be out of luck - the timing must be too sensative :(

    Looks like this might turn out to be a lifelong project. I'll have to slowly go through the code and try and set it up to work with my remote.
     
  20. Matt(Pic progger)

    Matt(Pic progger) Member

    Joined:
    Apr 29, 2004
    Messages:
    147
    Likes:
    0
    Location:
    UK
    Please stick with it! Are you using a genuine Xbox remote or an aftermarket version?

    Also this code is based on European remote's, I am not sure if there are any differences.

    Do you have a storage scope? Is it possible to send a trace of your rx'd "display" code?
     
  21. gregmcc

    gregmcc Member

    Joined:
    Aug 20, 2005
    Messages:
    303
    Likes:
    0
    Location:
    Darwen, UK
    Matt,

    I dont have the original MS remote - I think its a clone, but all the buttons work fine though XBMC. I dont have a storage scope either. I might try and build the circuit from lirc and see if I can display the codes.
     

Share This Page