ds30 Loader free edition forums
Make change in Loader for dsPIC33FJ128GP802 MCU - Printable Version

+- ds30 Loader free edition forums (https://picbootloader.com/forum)
+-- Forum: Support (https://picbootloader.com/forum/forumdisplay.php?fid=3)
+--- Forum: 16-bit firmwares (https://picbootloader.com/forum/forumdisplay.php?fid=6)
+--- Thread: Make change in Loader for dsPIC33FJ128GP802 MCU (/showthread.php?tid=650)



Make change in Loader for dsPIC33FJ128GP802 MCU - Ultron - 2013-08-29

Hi,
I'm come from PIC18Fxxxx and i am a rookie in dsPIC.

Please one question:

I read the manual for change for dsPIC33FJ128GP802 (DIP 28 Pin).

- I changed in the assembler file setting.inc, points for my dsPIC
- I deleted the old .gld linker file, and replace with correct dsPIC33FJ128GP802.gld

I build all, but this error appears: "error "PPS is not configured. More information in the firmware manual"

I (to try...) modified this line:

.ifdef HAS_PPS
.error "PPS is not configured. More information in the firmware manual."

with this one: .ifndef (if NOT def) and the compilation is ok, is done.

How can I do to solve correctly? Where I have to change the PPS??

Thanks

Guido from Italy

(remember: i'm not very experienced...)


RE: Make change in Loader for dsPIC33FJ128GP802 MCU - Mikael Gustavsson - 2013-09-05

Hi,
Sorry for the late reply. I've been on vacation.

PPS (peripheral pin select) is a feature on some PIC/dsPIC which allows peripherals to be mapped to different i/o pins. This must be configured properly for the boot loader to work. There is a template prepared for you in user_code.inc.

Which pins do you use for rx and tx?


RE: Make change in Loader for dsPIC33FJ128GP802 MCU - Ultron - 2013-09-06

(2013-09-05, 19:34:33)Mikael Gustavsson Wrote: Hi,
Sorry for the late reply. I've been on vacation.

PPS (peripheral pin select) is a feature on some PIC/dsPIC which allows peripherals to be mapped to different i/o pins. This must be configured properly for the boot loader to work. There is a template prepared for you in user_code.inc.

Which pins do you use for rx and tx?

Ok, thanks for reply! Smile

I have learn on Datasheet the PPS.

Some detail: i have this board, but the Seller does not provide the bootloader of the System:

[Image: %24T2eC16F,!zQE9s3sqJV-BRlNgR!PkQ~~60_12.JPG]
[Image: 2im5nd.jpg]

I have 4 of these cards and I wanted to use them with a normal bootloader.

- The pin for UART are 21 and 22
- Not Crystal, but Internal FRC

My chip is dsPIC33FJ128 GP

[Image: 361000_2_5.jpg]

I have modified:

Setting.inc with correct MCU line (dsPIC33FJ128GP)
Replaced .gld linker, with correct linker for my dsPIC.

Now I have to enter values ​​for the pins of the UART, in the user_code.inc?


RE: Make change in Loader for dsPIC33FJ128GP802 MCU - Mikael Gustavsson - 2013-09-06

It seems that board is made for PIC32. Is dsPIC33FJ128GP802 really supported?


RE: Make change in Loader for dsPIC33FJ128GP802 MCU - Ultron - 2013-09-06

If you look carefully, you see that the pin-out of these two chip is identical.

[Image: 2jam7bo.jpg]

Same package DIP28

MCLR is pin 1

Vdd = 13
Vss = 19
AVdd = 28
AVss = 27
Vcap = 20
etc. etc.


RE: Make change in Loader for dsPIC33FJ128GP802 MCU - Mikael Gustavsson - 2013-09-07

Ok. Please zip and post the boot loader project and I will help you.


RE: Make change in Loader for dsPIC33FJ128GP802 MCU - Ultron - 2013-09-09

First: Thanks for courtesy and help!

My "project" are a very little changes!

I simply modified, in the src folder, the setting.inc file with:

;------------------------------------------------------------------------------
; Device
;------------------------------------------------------------------------------
;.equ __24F16KA102, 1 ;xxx uncomment and change if using PIC24F device
;.equ __24FJ128GA010, 1 ;xxx uncomment and change if using PIC24FJ device
;.equ __24HJ128GP504, 1 ;xxx uncomment and change if using PIC24HJ device
;.equ __30F4013, 1 ;xxx uncomment and change if using dsPIC30F device
.equ __33FJ128GP802, 1 ;xxx uncomment and change if using dsPIC33FJ device

The last line is my change, with my device: dsPIC33FJ128GP802
All other lines in the file are unchanged

I opened ds30Loader.mcp with MPLAB IDE v8.92, i chose the chip in > Select Devices (my dsPIC33FJ128GP802).

I deleted the default gld linker and placed (Add files...) the gld linker for my dsPIC (p33FJ128GP802.gld)... and >Build all (Release)

In this way, the linker tell me this error: "error "PPS is not configured. More information in the firmware manual"

ok... then i go to user_code.inc at this macro:

;----------------------------------------------------------------------
; UART/CAN pps config
;----------------------------------------------------------------------
.ifdef HAS_PPS
.error "PPS is not configured. More information in the firmware manual." ;xxx remove this line when PPS is configured


and change the first .ifdef with .ifndef (ifNOTdef). In this way i re-compile >Build all, with success and program (with picKit3) correctly the MCU!
Obviously, not declaring the pins of the serial port nowhere, will not work. I think...


RE: Make change in Loader for dsPIC33FJ128GP802 MCU - Mikael Gustavsson - 2013-09-11

(2013-09-07, 22:44:30)Mikael Gustavsson Wrote: Ok. Please zip and post the boot loader project and I will help you.



RE: Make change in Loader for dsPIC33FJ128GP802 MCU - Ultron - 2013-09-11

(2013-09-11, 08:37:39)Mikael Gustavsson Wrote:
(2013-09-07, 22:44:30)Mikael Gustavsson Wrote: Ok. Please zip and post the boot loader project and I will help you.

Sorry!

I do not have a real project. I just changed the lines in the code, and compile the MCP Project in the \ds30 Loader\firmware_16-bit folder!


In attachment you can get the folder, with my changes.


1) add .equ __33FJ128GP802, 1 line in setting.inc, for my PIC
2) add p33FJ128GP802.gld in the mcp project (Linker Script > Add Files...)
3) Chose my dsPIC from Configure > Select Devices... (dsPIC33FJ128GP802)
4) replaced (for experiment) the .ifdef HAS_PPS in user_code.inc, with ifndef directive.

Stop, end of my changes.

4) Compile and program the chip with PicKit3.

I need help to configure correct serial pin (21-22) for the UART1 or UART2.


RE: Make change in Loader for dsPIC33FJ128GP802 MCU - Mikael Gustavsson - 2013-09-12

Thanks. Try this code, replace the existing code in user_code.inc
Code:
                ; Receive, map pin RB11/RP11 to UART2 Rx
                bclr    RPINR19, #U2RXR0        ;xxx
                bset    RPINR19, #U2RXR1        ;xxx
                bclr    RPINR19, #U2RXR2        ;xxx
                bset    RPINR19, #U2RXR3        ;xxx
                bclr    RPINR19, #U2RXR4        ;xxx
                        
                ; Transmit, map UART2 Tx to pin RB10/RP10
                bset    RPOR5, #RP10R0            ;xxx
                bclr    RPOR5, #RP10R1            ;xxx
                bset    RPOR5, #RP10R2            ;xxx
                bclr    RPOR5, #RP10R3            ;xxx
                bclr    RPOR5, #RP10R4            ;xxx



RE: Make change in Loader for dsPIC33FJ128GP802 MCU - Ultron - 2013-09-12

Good. Thanks!
1) Can you give me some explanation of the code?
2) Can I use the Configuration Bits of MPLAB IDE, and ignore the code in settings.inc? (uncheck "Configuration Bits set in code" radio button)


RE: Make change in Loader for dsPIC33FJ128GP802 MCU - Mikael Gustavsson - 2013-09-17

So it works now?
1) bset and bclr, sets and clears the bit(second argument) in the register(first argument). More info about PPS in the datasheet.
2) Yes you can.