View previous topic :: View next topic |
Author |
Message |
Rahalph
Joined: 01 Mar 2014 Posts: 36
|
Posted: Fri Oct 17, 2014 7:50 pm Post subject: UNconfig SERIALIN |
|
|
Hello everybody,
I have problems undoing a config statement. My AVR is connected to a PC via a Radio link. Both "ends" simulate a RS232 interface, so for the AVR and the PC it isn't much more than a "normal" RS232 communication. Before transferring data I have to initialize the radio Adapter what takes a lot of flash - but works absolutely fine. So, basic communication works!
Because my AVR has to do a lot of other stuff and the baud rate for the radio adapter is fixed 115200 baud I had to implement buffered data receiving...
Code: |
Config Serialin = Buffered , Size = 128
|
All that works so far, but one of the PC's commands can be "Enter bootloader", what makes the AVR jump to the bootloader section, receive more serial data (guess what: the new program code) and write the flash with SPM up to but not included the bootloader itself.
The bootloader as is works well, too. A small "main" program with initialization of the radio adapter and jump to the bootloader works!
But as soon as I implement the above config statement for IRQ based buffered receiving in the main program, the bootloader will not receive any data any more. What I need is a kind of
Code: |
Config Serialin = TheNormalWay
|
but it seems to me, there is no statement like that.
As said before I can't do the hole initialization of the radio adapter in the bootloader, I haven't got enough flash there. So the usual way "First bootloader, then main program" doesn't work. And my main definitely needs the buffered receiving. Can anybody help me to make the config statement undone and after buffered receiving in the main program having normal "Waitkey" receiving in the bootloader section?
Thank's
Ralph
(BASCOM-AVR version : 2.0.7.7 ) |
|
Back to top |
|
|
MWS
Joined: 22 Aug 2009 Posts: 2262
|
Posted: Fri Oct 17, 2014 9:05 pm Post subject: |
|
|
One option would be to enable the watchdog and run into an endless loop, followed by a watchdog reset and jump to the BL. Another option is simply disable interrupts, I suspect the enabled RXC-interrupt to crash your BL, one more is to directly disable the RXC interrupt. The BL routine uses its own code, so nothing more has to be "undone". |
|
Back to top |
|
|
O-Family
Joined: 23 May 2010 Posts: 320 Location: Japan
|
Posted: Sat Oct 18, 2014 1:31 am Post subject: |
|
|
Hi
Usually, reset of hardware is given to AVR, and where all the registers and interruption are initialized, it is rewritten by the new program by a boot loader.
Therefore, also when jumping from main program to a boot loader, initialization of a register and prohibition of interruption are needed.
First of all, when jumping from a main program to a boot loader, "Disable Interrupts" is performed, I will think that it is good. |
|
Back to top |
|
|
Rahalph
Joined: 01 Mar 2014 Posts: 36
|
Posted: Sat Oct 18, 2014 10:19 am Post subject: |
|
|
Yeah! Disabling the interrupts worked!
So simple. Why didn't I see that?
Thanks guys!!! |
|
Back to top |
|
|
P_Santos
Joined: 07 Jul 2011 Posts: 114
|
Posted: Wed Oct 22, 2014 11:29 pm Post subject: |
|
|
Hello Rahalph,
You say that your RS232 wireless comunication works fine. Can you inform the transceiver that you use, is the code easy to learn and use and if it is not very expensive
Thanks
Best regards
P_santos |
|
Back to top |
|
|
|