convert rs232 demo to avr

A collection of posts and articles on getting started in Flowcode v6

Moderator: Benj

Post Reply
JoeT
Posts: 14
Joined: Tue Sep 03, 2013 9:20 pm
Has thanked: 1 time
Contact:

convert rs232 demo to avr

Post by JoeT »

I am trying to convert the "rs232 simple echo" demo to a AVR Atmega128.
It will compile ok but if I try to create a HEX file it gives the error:
C:\Program Files (x86)\Flowcode 6\CAL\/AVR\AVR_CAL_UART.c:600:8: error: #error "UART channel 1 not available on this device"
This chip has two channels.
I went to "project options" change to atmega128 and the clock speed to 16mhz. Saved it and complied to "C". I went to the component dialog and when I select channel 1 the port pins change to the correct pins (E.0,E.1). It shows: Software; Channel1; Channel2; as selections.

What have I missed?
JoeT

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: convert rs232 demo to avr

Post by Benj »

Hi Joe,

Nothing you have missed just a minor bug, this is something that will be completely fixed in the next patch release.

For now you should be able to fix the issue by copying the file below into your Flowcode/CAL/AVR folder.
AVR_CAL_UART.c
(57.91 KiB) Downloaded 388 times
Then place the updated FCD into the FCD/AVR folder.
ATMEGA128.fcdx
(25.67 KiB) Downloaded 357 times
Let me know how you get on.

JoeT
Posts: 14
Joined: Tue Sep 03, 2013 9:20 pm
Has thanked: 1 time
Contact:

Re: convert rs232 demo to avr

Post by JoeT »

I downloaded the files and replace the old files with these.
Shut down flowcode and restarted.
No difference.
I tried software uart and it seems to work. At least compile to hex without errors.
But after I downloaded to the avr, I would get data but it was trash.
I tried different baud rates on the terminal program but no help.

When in project options can I change the crystal freq to a number like 14745600 hz?
Are only the selections in the drop down allowed?
I was wondering if this was the problem with the software uart.

JoeT

JoeT
Posts: 14
Joined: Tue Sep 03, 2013 9:20 pm
Has thanked: 1 time
Contact:

Re: convert rs232 demo to avr

Post by JoeT »

I am able to write to a 16x2 LCD from the program. With the clock (avr) freq of 14745600hz.
So the freq select seems to work with a inserted value.
If I type to the LCD via rs232 I get trash.

JoeT

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: convert rs232 demo to avr

Post by Benj »

Hi Joe,

Sorry for the delay.
When in project options can I change the crystal freq to a number like 14745600 hz?
The drop down selection in the project options also allows for direct number entry so you can put in custom values like this. If this setting is wrong then it explains why your data is not working as the baud will be being calculated incorrectly for your hardware.

Post Reply