|
Im pretty new to all this and so far have only been using Buffalo. Had a 5 min crash course on pcbug11 and b'strap mode of MC68HC11E9 which will be examined on tomorrow. Simple program written in Buffalo, ( make a led on portc flash and output a char to the screen every loop or flash of led )is working fine. here i am not using 'outa' instead reading 'scsr' then writing to 'scdr'.This works fine in Buffalo. Load the same program into pcbug11 (in b'strap mode and 'mm 1035 >$10' etc) and either starting program by 'G B600' or shorting TxD to RxD (pins 2-3 of RS232 connector)then reconnecting the RS232 cable,the program runs as the led flashes, but there is no characters being output to the screen,Instead the command prompt appears again. Stupid question, How can i get the chars to output to the screen when using pcbug11 ? Am i missing something stupid ? |
|
|
|
--- In , "garry_sharpe" <garry_sharpe@y...> wrote: > Im pretty new to all this and so far have only been using Buffalo. > Had a 5 min crash course on pcbug11 and b'strap mode of MC68HC11E9 > which will be examined on tomorrow. > > Simple program written in Buffalo, ( make a led on portc flash and > output a char to the screen every loop or flash of led )is working > fine. here i am not using 'outa' instead reading 'scsr' then > writing to 'scdr'.This works fine in Buffalo. > > Load the same program into pcbug11 (in b'strap mode and > 'mm 1035 >$10' etc) and either starting program by 'G B600' or > shorting TxD to RxD (pins 2-3 of RS232 connector)then reconnecting > the RS232 cable,the program runs as the led flashes, but there is > no characters being output to the screen,Instead the command > prompt appears again. > > Stupid question, How can i get the chars to output to the screen > when using pcbug11 ? Am i missing something stupid ? What sort of target hardware are you running this test program on? One thing that occurs to me is that there is at least one subtle difference (I think...?) between running a program under BUFFALO vs. using bootstrap mode. Actually, two relevant differences. First, BUFFALO will set up the SCI for you - it initializes BAUD, SCCR1, and SCCR2 such that the SCI runs at 9600bps (w/8 MHz xtal), so a 'lazy' programmer can get by with simply doing the SCSR read/SCDR write that you mention. However, the bootstrap mode does not work quite as conveniently. While the boostrap loader DOES do some SCI configuration before passing control to your program, it does NOT set the BAUD register in such a way as to run at 9600bps. Also (2nd point), I think that BUFFALO configures Port D to run in normal push/pull output mode, whereas the bootloader sets SPCR.DWOM=1, enabling the Port D 'wire-OR' (open drain) mode. In this mode, the high-side drivers for Port D outputs are disabled, allowing Port D outputs to SINK current but not SOURCE it. For the SCI to function correctly in this mode, you need a pull-up resistor (nom. 4.7K) on PD1 (TxD). If your hardware incorporates a MAX232/MAX202 or similar RS232 transciever, you *might* be able to get away without the pullup because these parts have integral weak pullups on the logic- level-side of the RS232 output drivers. (100K-400K, as I recall). The first thing you should do is to modify your test code such that it explicity initializes at least the BAUD register to your desired value ($30 is typical for 9600bps w/8 MHz xtal). It would also be prudent (but perhaps not absolutely necessary) to explicitly initialize SCCR1 and SCCR2 as well. You might also try explicitly setting SPCR.DWOM=0. Note that were you running your application in a 'standalone' environment; that is, from internal ROM or external memory immediately out of RESET, as opposed to running under BUFFALO or from bootstrap mode, initialization of all the SCI registers (BAUD, SCCR1, SCCR2) as well as the DDRD register would be MANDATORY. The state of these registers immediately out of RESET is such that the SCI is completely disabled. |
|
|
|
Mark Schultz <> wrote: --- In , "garry_sharpe" <garry_sharpe@y...> wrote: > Im pretty new to all this and so far have only been using Buffalo. > Had a 5 min crash course on pcbug11 and b'strap mode of MC68HC11E9 > which will be examined on tomorrow. > > Simple program written in Buffalo, ( make a led on portc flash and > output a char to the screen every loop or flash of led )is working > fine. here i am not using 'outa' instead reading 'scsr' then > writing to 'scdr'.This works fine in Buffalo. > > Load the same program into pcbug11 (in b'strap mode and > 'mm 1035 >$10' etc) and either starting program by 'G B600' or > shorting TxD to RxD (pins 2-3 of RS232 connector)then reconnecting > the RS232 cable,the program runs as the led flashes, but there is > no characters being output to the screen,Instead the command > prompt appears again. > > Stupid question, How can i get the chars to output to the screen > when using pcbug11 ? Am i missing something stupid ? What sort of target hardware are you running this test program on? One thing that occurs to me is that there is at least one subtle difference (I think...?) between running a program under BUFFALO vs. using bootstrap mode. Actually, two relevant differences. First, BUFFALO will set up the SCI for you - it initializes BAUD, SCCR1, and SCCR2 such that the SCI runs at 9600bps (w/8 MHz xtal), so a 'lazy' programmer can get by with simply doing the SCSR read/SCDR write that you mention. However, the bootstrap mode does not work quite as conveniently. While the boostrap loader DOES do some SCI configuration before passing control to your program, it does NOT set the BAUD register in such a way as to run at 9600bps. Also (2nd point), I think that BUFFALO configures Port D to run in normal push/pull output mode, whereas the bootloader sets SPCR.DWOM=1, enabling the Port D 'wire-OR' (open drain) mode. In this mode, the high-side drivers for Port D outputs are disabled, allowing Port D outputs to SINK current but not SOURCE it. For the SCI to function correctly in this mode, you need a pull-up resistor (nom. 4.7K) on PD1 (TxD). If your hardware incorporates a MAX232/MAX202 or similar RS232 transciever, you *might* be able to get away without the pullup because these parts have integral weak pullups on the logic- level-side of the RS232 output drivers. (100K-400K, as I recall). The first thing you should do is to modify your test code such that it explicity initializes at least the BAUD register to your desired value ($30 is typical for 9600bps w/8 MHz xtal). It would also be prudent (but perhaps not absolutely necessary) to explicitly initialize SCCR1 and SCCR2 as well. You might also try explicitly setting SPCR.DWOM=0. Note that were you running your application in a 'standalone' environment; that is, from internal ROM or external memory immediately out of RESET, as opposed to running under BUFFALO or from bootstrap mode, initialization of all the SCI registers (BAUD, SCCR1, SCCR2) as well as the DDRD register would be MANDATORY. The state of these registers immediately out of RESET is such that the SCI is completely disabled. Thanks for your input Mark, greatly appreciated. Problem solved.... I had already re-initialised everything in my source code rather than relying on the bootloader to do it for me (probably should have mentioned that in my original posting). So I was confident that the problem wasnt in the code however by chance, after you mentioned the max232, ( and having accidently bought 2 of them when building my trainer ), I replaced the existing max232 and the problem was solved. I dont know enough about it all as yet to be able to explain what was going wrong, but replacing it got me going again anyway. Once again thanks for the time you spent trouble shooting for me, greatly appreciated cheers Yahoo! Groups SponsorADVERTISEMENT --------------------------------- Yahoo! Groups Links To --------------------------------- Find local movie times and trailers on Yahoo! Movies. [Non-text portions of this message have been removed] |