View previous topic :: View next topic |
Author |
Message |
jfemboeck
Joined: 28 Jun 2006 Posts: 4 Location: Neuoetting
|
Posted: Tue Jun 17, 2014 12:45 pm Post subject: XMEGA change baudrate during runtime |
|
|
Hi all together,
Do sombody know, how it is possible to change the baudrate for example on channel 3 during runtime?
thanks a lot in advance..
(BASCOM-AVR version : 2.0.7.7 ) |
|
Back to top |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5914 Location: Holland
|
Posted: Tue Jun 17, 2014 1:09 pm Post subject: |
|
|
you can use :
BAUD2 = 19200
this will work for USART_D0
BAUD workd for C0, baud1 for C1, etc.
you need to use a constant. _________________ Mark |
|
Back to top |
|
|
jfemboeck
Joined: 28 Jun 2006 Posts: 4 Location: Neuoetting
|
Posted: Tue Jun 17, 2014 1:38 pm Post subject: |
|
|
Hallo Mark,
this is the code and I initialize the uart with:
Config Com1 = 115200 , Mode = Asynchroneous , Parity = None , Stopbits = 1 , Databits = 8
Open "COM1:" For Binary As #1
Do
Baud = 57600 'Baudrate wechseln
Tempw = E_start_stat : Print #1 , "E-Start_stat= " ; Hex(tempw)
Tempw = E_bootcnt : Incr Tempw : Print #1 , "Bootloads= " ; Tempw
Tempw = E_bootfail : Incr Tempw : Print #1 , "Bootfails= " ; Tempw
Tempw = E_config_cnt : Incr Tempw : Print #1 , "ConfigCount= " ; Tempw
Tempw = E_pwr_start : Incr Tempw : Print #1 , "PoweronCount= " ; Tempw
Waitms 300
Toggle Led_rot
Loop
If I just do it with 115200 it works well. but as soon I change the baudrate I get wrong data
Best regards
Josef |
|
Back to top |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5914 Location: Holland
|
Posted: Tue Jun 17, 2014 3:11 pm Post subject: |
|
|
Josef
this is actually a bug in the baud for xmega. the data is not written to baud ctrlA and B but twice to the B register.
if you write to support you can get an update since you have an SLA. _________________ Mark |
|
Back to top |
|
|
jfemboeck
Joined: 28 Jun 2006 Posts: 4 Location: Neuoetting
|
Posted: Tue Jun 17, 2014 3:54 pm Post subject: |
|
|
Many thanks for fast reaction..
I will contact support
Regards
Josef
|
|
Back to top |
|
|
jfemboeck
Joined: 28 Jun 2006 Posts: 4 Location: Neuoetting
|
Posted: Fri Jun 20, 2014 10:41 am Post subject: |
|
|
Hallo Mark,
now it works perfect.. Thx.
Regards
Josef |
|
Back to top |
|
|
Madf
Joined: 13 Nov 2011 Posts: 179 Location: Moscow
|
Posted: Sun Nov 23, 2014 8:49 pm Post subject: |
|
|
Hi Mark,
"Baud1" - works with: Com2, Serialin1, Open "COM2:" - OK.
"Baud" - no works!
This bug can be quickly fixed a version 2.0.7.6 for Xmega32A4? |
|
Back to top |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5914 Location: Holland
|
Posted: Wed Nov 26, 2014 1:19 pm Post subject: |
|
|
- since 2077 is out, there are no updates for 2076 other than 2077.
- please show a small but complete code that demonstrates the problem. _________________ Mark |
|
Back to top |
|
|
Madf
Joined: 13 Nov 2011 Posts: 179 Location: Moscow
|
Posted: Wed Nov 26, 2014 3:32 pm Post subject: |
|
|
Сode looks like this, but it is interested to version 2.0.7.6...
Code: |
...
Config Com1 = 19200 , Mode = Asynchroneous , Parity = None , Stopbits = 1 , Databits = 8
Config Com2 = 19200 , Mode = Asynchroneous , Parity = None , Stopbits = 1 , Databits = 8
Const Buff_len = 128
Config Serialin = Buffered , Size = Buff_len , Bytematch = All
Config Serialin1 = Buffered , Size = Buff_len , Bytematch = All
Open "COM2:" For Binary As #2
Dim Port0rx As Byte
Dim Port0rx_flag As Byte
Dim Port1rx As Byte
Dim Port1rx_flag As Byte
Reset Port0rx_flag
Reset Port1rx_flag
Baud = 9600 ' no works
Baud1 = 9600 ' works
Enable Interrupts
Clear Serialin
Clear Serialin1
Wait 2
Print "Start..."
Do
If Port0rx_flag <> 0 Then
Port0rx = Bufspace(1)
If Port0rx <> Buff_len Then
If Port0rx < 2 Then Reset Led
Port0rx = Inkey()
Printbin #2 , Port0rx
Else
Reset Port0rx_flag
End If
End If
If Port1rx_flag <> 0 Then
Port1rx = Bufspace(3)
If Port1rx <> Buff_len Then
If Port1rx < 2 Then Reset Led
Port1rx = Inkey(#2)
Printbin Port1rx
Else
Reset Port1rx_flag
End If
End If
Loop
End
Serial0bytereceived:
Set Port0rx_flag
Return
Serial1bytereceived:
Set Port1rx_flag
Return
|
|
|
Back to top |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5914 Location: Holland
|
Posted: Wed Nov 26, 2014 3:37 pm Post subject: |
|
|
sorry, i only look at problems reported in the latest version. _________________ Mark |
|
Back to top |
|
|
Madf
Joined: 13 Nov 2011 Posts: 179 Location: Moscow
|
Posted: Wed Nov 26, 2014 3:42 pm Post subject: |
|
|
If use the file "xm32a4def.dat" from the new version, it is not suitable for 2076? This does not solve the problem? |
|
Back to top |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5914 Location: Holland
|
Posted: Wed Nov 26, 2014 4:06 pm Post subject: |
|
|
no. _________________ Mark |
|
Back to top |
|
|
igortab
Joined: 08 Oct 2009 Posts: 14 Location: Sydney
|
Posted: Sat Nov 04, 2017 4:29 pm Post subject: |
|
|
Hi Mark and all,
BaudX does not work in version 2.0.8.0 with XM256A3U
Config Com3=9600, Mode=Asynchroneous, Parity=None, Stopbits=1, Databits=8 'USARTD1
Open "COM3:" For Binary As #1
Baud3=38400
Will still output at 9600
Regards |
|
Back to top |
|
|
EDC
Joined: 26 Mar 2014 Posts: 971
|
Posted: Sat Nov 04, 2017 5:26 pm Post subject: |
|
|
Com1 is The USART0 I think
Baud = should work with USART0
Baud1 = should work with USART1 = COM2
...
In my opiniion Baud3 is not for COM3 but I may be wrong
When I play with Vinculum I learn how to change Baudrate up to 2MegaBits for USART but today is not the case. |
|
Back to top |
|
|
igortab
Joined: 08 Oct 2009 Posts: 14 Location: Sydney
|
Posted: Sat Nov 04, 2017 5:36 pm Post subject: |
|
|
You are wrong. Read the help file. |
|
Back to top |
|
|
|