Non standard baud rates in the IDE?

Questions and discussion about the ZBasic IDE.
Post Reply
spamiam
Posts: 739
Joined: 13 November 2005, 6:39 AM

Non standard baud rates in the IDE?

Post by spamiam »

Is there a way to set the IDE to use a non-0standard baud rate for the serial port?

I am using the ZBaasic IDE and ZBoot bootloader on an ATMega328P which has a 16MHz crystal. Additionally it has a USB interface using a FT232R USB-Serial converter.

Needless to say, the 16MHz clock on the AVR renders it unable to create all the Standard baud rates, and only the slower rates are able to come close enough to synch properly.

I'd love to be able to get faster baud rates without running risk of com errors with long transmissions.

The FT232R is able to accept non-standard baud rates. Essentially, it can achieve a perfect synch with the 16MHz AVR at any baud rate it is capable of producing. The FT232R uses a clock that can produce a baudrate of 24MHz divided by any integer with a maximum baud of 3M.

So, I can achieve just as good serial communication with the device using certain non-standard baud rates as one can with a 14.7MHz clock on the ZX devices with standard baud rates. I just need to get the IDE to offer some non-standard baud rates.

-Tony
dkinzer
Site Admin
Posts: 3120
Joined: 03 September 2005, 13:53 PM
Location: Portland, OR

Re: Non standard baud rates in the IDE?

Post by dkinzer »

spamiam wrote:Is there a way to set the IDE to use a non-standard baud rate for the serial port?
Although I haven't tried this, I suspect that you can accomplish this is by editing the User Properties file manually. Look for entries like those below and substitute your non-standard rates.

Code: Select all

debug.speed=19200
download.speed=57600
There may be an issue that arises if you invoke the Serial Options dialog after you've changed to a non-standard speed. You may have to re-edit after each save.
- Don Kinzer
spamiam
Posts: 739
Joined: 13 November 2005, 6:39 AM

Post by spamiam »

Thanks. I was hoping that maybe there would be a complete editable list somewhere that is used to populate those IDE choice boxes. I will try your suggestion! I would also expect that when the dialog box is invoked it will overwrite the manually edited settings
dkinzer
Site Admin
Posts: 3120
Joined: 03 September 2005, 13:53 PM
Location: Portland, OR

Post by dkinzer »

spamiam wrote:I was hoping that maybe there would be a complete editable list somewhere that is used to populate those IDE choice boxes.
I've added properties to specify the baud rates to display in the dropdown listboxes for the debug baud rate and download baud rate. The properties are debug.speed.list and download.speed.list and the value should be a comma-separated list of baud rates, e.g.

Code: Select all

download.speed.list=9600,10000,19200
With this present in the User Properties file, only those three speeds will be present in the dropdown for the download speed. If the property is not specified, the standard baud rates from 300 to 460,800 will appear as before.

You can try out this experimental version by downloading the .zip file at the link below and extracting the .exe file to the IDE subdirectory of the ZBasic installation directory. This version also fixes the Project|Open issue reported in another thread.
http://www.zbasic.netl/download/ZBasicI ... _1-6-8.zip
- Don Kinzer
spamiam
Posts: 739
Joined: 13 November 2005, 6:39 AM

Post by spamiam »

Don,

Thanks for the changes! I had a little trouble with it, however.

I entered the changes in the file popped up by selecting the menu: Option->Open User Options File

I changed the line

Code: Select all

download.speed=115200
to

Code: Select all

download.speed.list=300,600,1200,2400,4800,9600,14400,19200,28800,38400,50000,57600,76923,100000,115200,125000,230400,250000,460800,500000
When I reopened the IDE, it populated the list with all the items listed. But the list in User Options disappeared entirely after I selected one of the listed speed, and the text res replaced by the single speed selected, and the combobox then only got populated by the default speeds, no longer the customized list.

Maybe I put the list in the wrong file?

I can confirm that the technique of setting non-standard speeds works GREAT. I made the changes you suggested with the older IDE. I picked 125000 baud as one that will work with the USART on the ATMega328P when it is set on Single Speed. I created a customized bootloader very easily with your BAT file and H file. The IDE downloaded the program to the chip just fine at 125000 baud. It communicated to the Output Pane jsut fine too. BUT the new IDE does not seem to communicate properly with the user options set to download.speed=125000 and the debug speed set similarly. I can't tell what speed it is actually using, but it is not 125000.

-Tony
dkinzer
Site Admin
Posts: 3120
Joined: 03 September 2005, 13:53 PM
Location: Portland, OR

Post by dkinzer »

spamiam wrote:But the list in User Options disappeared entirely after I selected one of the listed speed, and the text res replaced by the single speed selected [...].
I remember now that there has been a problem such as you describe when a property being updated is a prefix of another. I fixed that problem and it seems to update fine now leaving other properties untouched. I uploaded a new .zip file with the new build but the version number was left the same.
spamiam wrote:BUT the new IDE does not seem to communicate properly with the user options set to download.speed=125000 and the debug speed set similarly.
I'm not clear on what does work and what does not work. Can you summarize, please?
- Don Kinzer
spamiam
Posts: 739
Joined: 13 November 2005, 6:39 AM

Post by spamiam »

Don,

It is perfect!

I am running ZBoot at 125K baud, single speed. It is able to upload programs and communicate to the Output pane at 125K as well.

The Zbasic system is now, as far as I can tell, 100% compatible with any arbitrary crystal frequency. At most, all one needs to do is adjust settings when compiling a new ZBoot file.

Thank you!

-Tony
Post Reply