CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Bootloader & PPS
Goto page 1, 2, 3  Next
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
kmp84



Joined: 02 Feb 2010
Posts: 345

View user's profile Send private message

Bootloader & PPS
PostPosted: Tue Dec 01, 2020 2:24 pm     Reply with quote

Hello,

I'm using "pcd_aux_bootloader" for dsPic33EP512MU810 on hardware UART1 and application using UART1 and UART2. If UART2 not configured in bootloader (not set #pin_select Rx,Tx) it doesn't start also in application. Any workaround for this kinds of problems?

Best Regards!


Last edited by kmp84 on Fri Dec 04, 2020 9:30 am; edited 1 time in total
kmp84



Joined: 02 Feb 2010
Posts: 345

View user's profile Send private message

PostPosted: Tue Dec 01, 2020 4:21 pm     Reply with quote

I found the solution at the top of the forum Very Happy "Sticky : How to use #pin_select" from Ttelmah's post:

Quote:

One 'caveat' to add to this, applies with bootloaders.
If you have a bootloader, and it uses a PPS peripheral (so maps anything
with PPS), you need to ensure the NOIOL1WAY fuse is selected. Otherwise
your main code will not be able to change the pin settings.
The IOL1WAY fuse means that things can be set only once. Problem is if
the bootloader is setting them, then the 'main' code can't set them again....


Best Regards!
Ttelmah



Joined: 11 Mar 2010
Posts: 19217

View user's profile Send private message

PostPosted: Wed Dec 02, 2020 2:37 am     Reply with quote

Glad you found it. Smile
kmp84



Joined: 02 Feb 2010
Posts: 345

View user's profile Send private message

PostPosted: Wed Dec 02, 2020 3:15 am     Reply with quote

I'm thinking about how to start bootloader from application without switching some jumpers. For example receiving some command from UART "StartBoot\r\n". Any idea..?
kmp84



Joined: 02 Feb 2010
Posts: 345

View user's profile Send private message

PostPosted: Wed Dec 02, 2020 3:19 am     Reply with quote

One simple scenario that I can do is to Set flag in external i2c memory, restart dsPic and bootloader check for flag. Is it possible?
Ttelmah



Joined: 11 Mar 2010
Posts: 19217

View user's profile Send private message

PostPosted: Wed Dec 02, 2020 3:32 am     Reply with quote

The 'best' way I know of to do this, is to have the bootloader start, if the
RS232 is receiving 'break' when the chip starts. Since an TTL serial line
'idles high', and it is easy to add a pull up, to ensure this happens, the
code can simply test the line, and exit if it is high.
Then in your main code when you want to trigger the bootloader, just
tell your user to start your download program, which starts by sending
a 'break' (holding the line low), and then your code calls reset_cpu. The
chip then restarts, and sees the line low. It this point the bootloader starts
and sends a status to say "I'm here" to the attached program, which then
starts sending.
kmp84



Joined: 02 Feb 2010
Posts: 345

View user's profile Send private message

PostPosted: Wed Dec 02, 2020 4:59 am     Reply with quote

Thanks mr.'Ttelmah',

Best Wishes!
kmp84



Joined: 02 Feb 2010
Posts: 345

View user's profile Send private message

PostPosted: Thu Dec 03, 2020 8:55 am     Reply with quote

Hello again,

How and where to protect aux&code memory from read?
Protect in bootloader or aplication? When protected in bootloader it doesn't start!

Best Regards!
Ttelmah



Joined: 11 Mar 2010
Posts: 19217

View user's profile Send private message

PostPosted: Thu Dec 03, 2020 1:39 pm     Reply with quote

In the bootloader. It should not allow any write to areas that should not
change.
kmp84



Joined: 02 Feb 2010
Posts: 345

View user's profile Send private message

PostPosted: Fri Dec 04, 2020 9:26 am     Reply with quote

There is some errata issue (31. Module: Auxiliary Flash), but work around doesn't work. When I set below fuses bootloader doesn't start.
Code:


#include <33EP512MU810.h>
#fuses NOWDT,RESET_AUX,NOIOL1WAY
#fuses PROTECT                              //with this line bootloader doesnt start!

#build (AUX_MEMORY)                         //Build code for Auxiliary Memory
#use delay(clock=32MHz, crystal=8MHz)

...............


CCS C v.5.093
temtronic



Joined: 01 Jul 2010
Posts: 9100
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Fri Dec 04, 2020 9:42 am     Reply with quote

My guess is that 'PROTECT' prevents the bootloader from programming PROTECTED memory ????
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Dec 04, 2020 10:03 am     Reply with quote

The dsPIC33EP512MU810 data sheet says:
Quote:
29.8 Code Protection and CodeGuard™ Security

The dsPIC33EPXXX(GP/MC/MU)806/810/814 and
PIC24EPXXX(GP/GU)810/814 devices do not support
Boot Segment (BS)
, Secure Segment (SS) and RAM
protection.

That's your PIC, and it doesn't support boot block protection.
kmp84



Joined: 02 Feb 2010
Posts: 345

View user's profile Send private message

PostPosted: Fri Dec 04, 2020 10:54 am     Reply with quote

temtronic wrote:
My guess is that 'PROTECT' prevents the bootloader from programming PROTECTED memory ????


I don't get to programming at all. "pcd_aux_bootloader" doesn't start with "PROTECT" fuse.
kmp84



Joined: 02 Feb 2010
Posts: 345

View user's profile Send private message

PostPosted: Fri Dec 04, 2020 11:01 am     Reply with quote

PCM programmer wrote:
The dsPIC33EP512MU810 data sheet says:
Quote:
29.8 Code Protection and CodeGuard™ Security

The dsPIC33EPXXX(GP/MC/MU)806/810/814 and
PIC24EPXXX(GP/GU)810/814 devices do not support
Boot Segment (BS)
, Secure Segment (SS) and RAM
protection.

That's your PIC, and it doesn't support boot block protection.


Generally I want to protect code memory and if possible aux memory from reading. if that can't be done then what are purpose of"PROTECT,APROTECT" fuses?
Ttelmah



Joined: 11 Mar 2010
Posts: 19217

View user's profile Send private message

PostPosted: Fri Dec 04, 2020 11:37 am     Reply with quote

The key here is you need to set the GSSK bits as well as the GSS bit.
The GSS bit is the protect one you are setting, but if this is set, and not
the GSSK bits, this puts the chip into 'full protect' mode, which stops the
bootloader from being able to work. These are the 'general segment key'
bits. GSSK in the fuses.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page 1, 2, 3  Next
Page 1 of 3

 
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


Powered by phpBB © 2001, 2005 phpBB Group