Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

UNconfig SERIALIN

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    www.mcselec.com Forum Index -> BASCOM-AVR Archive
View previous topic :: View next topic  
Author Message
Rahalph

Bascom Member



Joined: 01 Mar 2014
Posts: 36

PostPosted: Fri Oct 17, 2014 7:50 pm    Post subject: UNconfig SERIALIN Reply with quote

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
View user's profile
MWS

Bascom Member



Joined: 22 Aug 2009
Posts: 1915

blank.gif
PostPosted: Fri Oct 17, 2014 9:05 pm    Post subject: Reply with quote

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
View user's profile
O-Family

Bascom Expert



Joined: 23 May 2010
Posts: 237
Location: Japan

japan.gif
PostPosted: Sat Oct 18, 2014 1:31 am    Post subject: Reply with quote

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
View user's profile Visit poster's website
Rahalph

Bascom Member



Joined: 01 Mar 2014
Posts: 36

PostPosted: Sat Oct 18, 2014 10:19 am    Post subject: Reply with quote

Yeah! Disabling the interrupts worked!
So simple. Why didn't I see that? Embarassed

Thanks guys!!! Very Happy
Back to top
View user's profile
P_Santos

Bascom Member



Joined: 07 Jul 2011
Posts: 111

PostPosted: Wed Oct 22, 2014 11:29 pm    Post subject: Reply with quote

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
View user's profile
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    www.mcselec.com Forum Index -> BASCOM-AVR Archive All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum