Hi, when I try to compile with the macro ‘SetBaud’ I get this error (and other similar ones):
error: ‘UBRR1L’ undeclared (first use in this function)
What exactly does this mean?
Thanks and best regards Chris
compilation error
-
- Posts: 103
- http://meble-kuchenne.info.pl
- Joined: Mon Dec 07, 2020 12:47 pm
- Been thanked: 1 time
-
- Matrix Staff
- Posts: 1924
- Joined: Wed Dec 02, 2020 11:07 pm
- Has thanked: 623 times
- Been thanked: 645 times
Re: compilation error
If you change the target device to one that does contain all the SFR's e.g. ATMEGA640 then the code will compile successfully.
Is there a reason for creating your own C code?
I would recommend if it's for learning, check register names within the microcontroller datasheet first.
ATMEGA328 only contains UBRR0H/L, all the other register e.g. UBRR1H/L etc are missing.
Hence reason for failing to compile.
Is there a reason for creating your own C code?
I would recommend if it's for learning, check register names within the microcontroller datasheet first.
ATMEGA328 only contains UBRR0H/L, all the other register e.g. UBRR1H/L etc are missing.
Hence reason for failing to compile.
Martin
Re: compilation error
Unfortunately, the normal ‘ChangeHWBaude’ function for the UART does not work. There have already been posts about this here...
-
- Matrix Staff
- Posts: 1924
- Joined: Wed Dec 02, 2020 11:07 pm
- Has thanked: 623 times
- Been thanked: 645 times
Re: compilation error
In that case, thank you for letting us know.
I will put it on my list to investigate, so you won't need to use C code.
If I replicate it not working, I will move the topic to Bugs.
Martin
-
- Matrix Staff
- Posts: 1924
- Joined: Wed Dec 02, 2020 11:07 pm
- Has thanked: 623 times
- Been thanked: 645 times
Re: compilation error
As you have not added 9 or 10 post icon, I will assume you are using FC10.
Just tested on the Uno and ChangeHWBaud is working as intended, toggling between 4800 and 19200 .
Analyser set for 2400 & sending U: Do have an example .fcfx project where it is not working?
Just tested on the Uno and ChangeHWBaud is working as intended, toggling between 4800 and 19200 .
Analyser set for 2400 & sending U: Do have an example .fcfx project where it is not working?
Martin
Re: compilation error
I have to generate a new project first, I can do that. I'm not using a UNO etc. but the chip direct, an ATMEGA328P and 328PB.
Re: compilation error
I have tested it again, I am transmitting from one module with 115200 baud to another. If I configure the UART of the receiver module with 9600 baud and then set it to 115200 with ChangeHWBaud after initialisation in the program, it does not work.