Forum Index
HomeZBasic Home   Forum RulesForum Rules   Forum FAQForum FAQ   MemberlistMemberlist   UsergroupsUsergroups   RSS FeedRSS Feed
LinksLinks   DownloadDownload   Digests and SubscriptionsDigests and Subscriptions
ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in   RegisterRegister
Generic UART not working above 57600

 
Post new topic   Reply to topic    Forum Index -> ZBasic for Generic Targets
Author Message
kurakaira



Joined: 21 Mar 2007
Posts: 68
Location: Finland

Posted: 26 July 2017, 13:28 PM    Post subject: Generic UART not working above 57600 Reply with quote

Generic targets work great ,,, as long as You keep below ConsoleSpeed of 57600 ... 115200 does not work for my boards , is it a generic target issue or something i have overlooked ?
This affects both the 328P & Mega2560 . . .


Code:

Option TargetDevice ATmega2560
Option DeviceParameter clockFrequency 16000000
Option DeviceParameter rtcFrequency 500
Option DeviceParameter rtcScale 1
Option DeviceParameter swUartDivisor 8
Option DeviceParameter swUartMinSpeed 300
Option DeviceParameter swUartMaxSpeed 19200
Option DeviceParameter swUartBaseSpeed 2400
Option DeviceParameter timerSpeed1Divisor 1
Option DeviceParameter timerSpeed2Divisor 8
Option DeviceParameter ZBasicBootloader True

Option ConsoleSpeed 115200  ' 57600 works fine
Option RTC on
Option Signon on
Option TxQueueSize 100
Option RxQueueSize 40
Option Console Com1

Const Led as byte = B.7

Sub Main()

Debug.Print "Hello From 2560"

Do
Debug.Print "Hello ."
Call PutPin(Led, 1)
Call Delay(1.0)
Call PutPin(Led, 0)
Debug.Print "It Really Works :)"
Call Delay(0.5)
Loop
End Sub
Back to top
dkinzer
Site Admin


Joined: 03 Sep 2005
Posts: 2991
Location: Portland, OR

Posted: 10 August 2017, 2:16 AM    Post subject: Re: Generic UART not working above 57600 Reply with quote

kurakaira wrote:
Generic targets work great ,,, as long as You keep below ConsoleSpeed of 57600 ... 115200 does not work for my boards , is it a generic target issue or something i have overlooked ?
At 16MHz, the available divisors cannot produce an accurate baud rate at 115.2K baud and above. The error at 115.2K baud is 2.1%, at 230.4K baud it is 3.5%, and at 460.8K baud it is 8.5%. It should work at 76.8K baud where the error is only 0.2%.

You can see the list of baud rates and error values by using the Target Options dialog, setting the processor frequency, and clicking the Apply button.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Forum Index -> ZBasic for Generic Targets Time synchro. with the server - Timezone/DST with your computer
Page 1 of 1

 


All content Copyright © 2005-2017 Elba Corp. All rights reserved.
Opinions expressed in posts are those of the author and not necessarily those of Elba Corp.
Powered by phpBB © 2001, 2005 phpBB Group