Shop OBEX P1 Docs P2 Docs Learn Events
works running debug but not when programmed — Parallax Forums

works running debug but not when programmed

thomasschubertthomasschubert Posts: 15
edited 2012-11-29 18:57 in General Discussion
Hi all

Im having some huge issues with the SX compiler, I have alsways written in assembler and have never come across this issue.
I have a program that runs with the internal 4MHZ SX28 clock, Im using Serout and Serin uart commands. When I run debug the data Im sending out looks good at 96,n,8,1.
Im using hyperterminal to view the data.

When I program the device, I get rubbish, looks like its off on the serout timming. I thought maybe at 9600 this may to too quick for 4MHZ so I changed to 50MHZ and recomplied and still the same data issues.

Anyone have this problem, Im under the gun on this project.
Below are my osc settings

DEVICE SX28, OSC4MHZ, TURBO, STACKX, OPTIONX
FREQ 4_000_000
IRC_CAL IRC_FAST
ID "Controller"


Thanks

Comments

  • Shawn LoweShawn Lowe Posts: 635
    edited 2012-11-29 12:24
    you must use an external crystal when trying to use serout. It works with debug because it is using the clock source on the key to transmit data (IIRC)
  • thomasschubertthomasschubert Posts: 15
    edited 2012-11-29 13:22
    Shawn Lowe wrote: »
    you must use an external crystal when trying to use serout. It works with debug because it is using the clock source on the key to transmit data (IIRC)

    Hi, theres somthing strange with the compiler calculating the timming for serout and in commands. Running at 4MHZ internal, I do realize there is a 5% error I had to set the baud rate to 8600, not 9600. Im now using a 50MHZ resonator, still the timming is not right. As I cant run the SX debugger at 50MHZ, Im not sure how I figure out what the error here is.

    It may also be the Device directive that wrong, please see my directive below.
    DEVICE SX28,oschs2,TURBO
    IRC_CAL IRC_SLOW

    This is what i used on prevous projects Ive designed but using ASM not the compiler.
  • ZootZoot Posts: 2,227
    edited 2012-11-29 18:57
    You would still need to specify the resonator/crystal frequency as directive in the SX/B program. The FREQ directive is used for calculating delays and timings (based on clock cycles) for higher level commands like SERIN/SEROUT, FREQOUT, PULSIN/PULSOUT, clocks on SPI/I2C, etc.

    Can you post your whole program -- as an attachment?
Sign In or Register to comment.