50Mhz processor upgrade

nroff-man
Posts: 40
Joined: Wed Oct 01, 2014 6:05 pm

Re: 50Mhz processor upgrade

Post by nroff-man » Mon Mar 16, 2015 9:37 am

lo

test hex:
http://dev.kewl.org/misc/hex/CHIPKIT_DP32_MX270_48.hex

test linker script:
http://dev.kewl.org/misc/hex/chipKIT-ap ... 270F256.ld

bye

EDIT:

PS. There looks like there are some bugs with this USB boot loader
memory mapping. I will see about solving this now.

GastonLagaffe
Posts: 101
Joined: Sun Oct 26, 2014 2:50 pm

Re: 50Mhz processor upgrade

Post by GastonLagaffe » Mon Mar 16, 2015 9:48 am

Salut,

thanks for the hex (really impressive turnaround speed) - I checked the chip I received last week and noticed that I have them in SOIC not in SPDIP. But the SOIC PCB is still in production with OSH. I expect to receive the SPDIP chips by the end of this week and will test then.

Sorry for the delay (I was on a business trip in Saudi Arabia for a week and have to catch up with what happened at home while away)

Ciao, Mathias

nroff-man
Posts: 40
Joined: Wed Oct 01, 2014 6:05 pm

Re: 50Mhz processor upgrade

Post by nroff-man » Mon Mar 16, 2015 10:02 am

Good day
GastonLagaffe wrote:Salut,

thanks for the hex (really impressive turnaround speed) - I checked the chip I received last week and noticed that I have them in SOIC not in SPDIP. But the SOIC PCB is still in production with OSH. I expect to receive the SPDIP chips by the end of this week and will test then.

Sorry for the delay (I was on a business trip in Saudi Arabia for a week and have to catch up with what happened at home while away)

Ciao, Mathias
The delay is no problem.

I already updated the hex file and linker script fixing the `deliberate mistake'
in the memory map.

This is all untested but testing it is the only way to fix it. I am glad you
prompted this otherwise I wouldn't have even looked closer at it.

Bye-bye

GastonLagaffe
Posts: 101
Joined: Sun Oct 26, 2014 2:50 pm

Re: 50Mhz processor upgrade

Post by GastonLagaffe » Mon Mar 23, 2015 12:49 am

Salut,

I received the chips yesterday and have one now on my HelvePic32 board. I was able to access the chip via PicKit3 and to write the bootloader. The chip acts as expected and I was able to load a sketch to it using UECIDE.
I placed the load script in the github directory where I found the other loader scripts but I have no idea how to select this chip in UECIDE. I guess there is some more work to do ...

However, the first step, to get the hardware up and the bootloader running is quite an achievement

Ciao, Mathias

User avatar
majenko
Site Admin
Posts: 2164
Joined: Wed Nov 09, 2011 7:51 pm
Location: UK
Contact:

Re: 50Mhz processor upgrade

Post by majenko » Mon Mar 23, 2015 9:59 am

The chip is selected in the board.txt file. The most important lines to consider when changing your chip to a different one are:

The linker script:

Code: Select all

ldscript=chipKIT-application-32MX250F128${upload.${prefs:board.${prefs:board}.programmer}.ldsuffix}.ld
The actual chip in use:

Code: Select all

build.mcu=32MX250F128B
The speed the chip runs at:

Code: Select all

build.f_cpu=40000000L
You also need to edit cpudefs.h to add the MX270 chip. Duplicate the MX250's entries and bend them to the 270:

Code: Select all

    #elif defined(__32MX250F128B__)
        #define _CPU_NAME_      "32MX250F128B"
        #define FLASHEND        (((128 - 4) * 1024L) - 1)
        #define RAMEND          ((32 * 1024L) - 1)
        #define __PIC32_PINS__  28
        #define __PIC32MX2XX__

    #elif defined(__32MX250F128C__)
        #define _CPU_NAME_      "32MX250F128C"
        #define FLASHEND        (((128 - 4) * 1024L) - 1)
        #define RAMEND          ((32 * 1024L) - 1)
        #define __PIC32_PINS__  36
        #define __PIC32MX2XX__

    #elif defined(__32MX250F128D__)
        #define _CPU_NAME_      "32MX250F128D"
        #define FLASHEND        (((128 - 4) * 1024L) - 1)
        #define RAMEND          ((32 * 1024L) - 1)
        #define __PIC32_PINS__  44
        #define __PIC32MX2XX__
Why not visit my shop? http://majenko.co.uk/catalog
Universal IDE: http://uecide.org
"I was trying to find out if it was possible to only eat one Jaffa Cake. I had to abandon the experiment because I ran out of Jaffa Cakes".

GastonLagaffe
Posts: 101
Joined: Sun Oct 26, 2014 2:50 pm

Re: 50Mhz processor upgrade

Post by GastonLagaffe » Mon Mar 23, 2015 11:44 am

Salut,

it looks like I am almost there...
I changed board.txt:

Code: Select all

ldscript=chipKIT-application-32MX270F256${upload.${prefs:board.${prefs:board}.programmer}.ldsuffix}.ld
upload.maximum_size=245760
build.mcu=32MX270F256B
build.f_cpu=40000000L
cpudefs.h:

Code: Select all

    #elif defined(__32MX270F256B__)
		#define _CPU_NAME_	"32MX270F256B"
		#define	FLASHEND	(((256 - 4) * 1024L) - 1)
		#define	RAMEND		((64 * 1024L) - 1)
		#define	__PIC32MX2XX__

	#elif defined(__32MX270F256C__)
		#define _CPU_NAME_	"32MX270F256C"
		#define	FLASHEND	(((256 - 4) * 1024L) - 1)
		#define	RAMEND		((64 * 1024L) - 1)
		#define	__PIC32MX2XX__

	#elif defined(__32MX270F256D__)
		#define _CPU_NAME_	"32MX270F256D"
		#define	FLASHEND	(((256 - 4) * 1024L) - 1)
		#define	RAMEND		((64 * 1024L) - 1)
		#define	__PIC32MX2XX__
p32xxxx.h:

Code: Select all

#elif defined(__32MX270F256B__)
#include <proc/p32mx270f256b.h>
#elif defined(__32MX270F256C__)
#include <proc/p32mx270f256c.h>
#elif defined(__32MX270F256D__)
#include <proc/p32mx270f256d.h>
Copied three files proc/p32mx250f128?.h to proc/p32mx270f256?.h and changed the $ifdef inside to reflect the name
Created three directories from the MX250 versions at

Code: Select all

c:\UECIDE\compilers\pic32-tools\pic32mx\lib\proc\32MX270F256B\
c:\UECIDE\compilers\pic32-tools\pic32mx\lib\proc\32MX270F256C\
c:\UECIDE\compilers\pic32-tools\pic32mx\lib\proc\32MX270F256D\
It now compiles ok but the load has a problem:

Code: Select all

Linking sketch...
C:\UECIDE\compilers\pic32-tools/bin/pic32-gcc -O2 -Wl,--gc-sections -T Not found -T C:\UECIDE\cores\chipKIT/api/chipKIT-application-COMMON.ld -D_USE_USB_FOR_SERIAL_ -w -mprocessor=32MX270F256B -o C:\Users\mawilhel\AppData\Local\Temp\build-b6a73b69-5ef4-4011-b0f6-928b054ffa1e/Blink.elf C:\Users\mawilhel\AppData\Local\Temp\build-b6a73b69-5ef4-4011-b0f6-928b054ffa1e\Blink.cpp.o -LC:\Users\mawilhel\AppData\Local\Temp\build-b6a73b69-5ef4-4011-b0f6-928b054ffa1e -LC:\UECIDE\cache\chipKIT\HelvePic32 -Wl,--start-group -lCore_api -Wl,--end-group -lm 
C:/UECIDE/compilers/pic32-tools/bin/../lib/gcc/pic32mx/4.5.1/../../../../pic32mx/bin/ld.exe: cannot open linker script file Not found: No such file or directory
collect2: ld returned 1 exit status
Failed linking sketch
Obviously the linked gets called but a file is not found "-T Not found" - but I have no clue what file is missing.

Ciao, Mathias

User avatar
majenko
Site Admin
Posts: 2164
Joined: Wed Nov 09, 2011 7:51 pm
Location: UK
Contact:

Re: 50Mhz processor upgrade

Post by majenko » Mon Mar 23, 2015 12:08 pm

It looks to me like you're on the older version of the compiler. You shouldn't have needed to modify anything in the compiler's files if you were using the latest version.

For the "release" version of UECIDE you should be working with the chipKIT-Git core and the pic32-tools-MZ compiler. For the beta version it's sufficient to just use the "chipkit" core, since it's the latest one.

The older compiler lacks the knowledge of how to deal with the newer chips. You need to use the later version.
Why not visit my shop? http://majenko.co.uk/catalog
Universal IDE: http://uecide.org
"I was trying to find out if it was possible to only eat one Jaffa Cake. I had to abandon the experiment because I ran out of Jaffa Cakes".

GastonLagaffe
Posts: 101
Joined: Sun Oct 26, 2014 2:50 pm

Re: 50Mhz processor upgrade

Post by GastonLagaffe » Mon Mar 23, 2015 12:43 pm

Salut,

this platform is getting better every day...

I switched to the GIT version and it compiles, loader script is found and ok.
I had to duplicate the MX250F128B definitions in the avrdude.conf file and modify the name

Code: Select all

#------------------------------------------------------------
# Pic CPU PIC32MX270F256B added by Mathias Wilhelm, March 2015
#------------------------------------------------------------

part
    id               = "pic32-270-256-B";
    desc             = "32MX270F256B";
I then used the blink sketch for testing:

Code: Select all

Compiling...
• Compiling sketch...
C:\UECIDE\compilers\pic32-tools-MZ/bin/pic32-g++ -c C:\Users\mawilhel\AppData\Local\Temp\build-b6a73b69-5ef4-4011-b0f6-928b054ffa1e\Blink.cpp -o C:\Users\mawilhel\AppData\Local\Temp\build-b6a73b69-5ef4-4011-b0f6-928b054ffa1e\Blink.cpp.o -mprocessor=32MX270F256B -G1024 -g -O2 -fno-exceptions -ffunction-sections -fdata-sections -mno-smart-io -mdebugger -Wcast-align -fno-short-double -DF_CPU=40000000L -DARDUINO=157 -D_BOARD_HELVEPIC32_ -DMPIDEVER=10001932 -DMPIDE=157 -IC:\UECIDE\cores\chipKIT-Git\api -IC:\UECIDE\boards\Boxtec\HelvePic32b -IC:\Users\mawilhel\AppData\Local\Temp\build-b6a73b69-5ef4-4011-b0f6-928b054ffa1e -IC:\UECIDE\cores\chipKIT\examples\1.Basics\Blink -D_USE_USB_FOR_SERIAL_ -w 
• Compiling core...
‣ api
• Compiling libraries...
• Linking sketch...
C:\UECIDE\compilers\pic32-tools-MZ/bin/pic32-g++ -Os -Wl,--gc-sections,-Map,Blink.map -mdebugger -mno-peripheral-libs -nostartfiles -T C:\UECIDE\cores\chipKIT-Git\api\chipKIT-application-32MX270F256.ld -T C:\UECIDE\cores\chipKIT-Git\api\chipKIT-application-COMMON.ld -D_USE_USB_FOR_SERIAL_ -w -mprocessor=32MX270F256B -o C:\Users\mawilhel\AppData\Local\Temp\build-b6a73b69-5ef4-4011-b0f6-928b054ffa1e/Blink.elf C:\Users\mawilhel\AppData\Local\Temp\build-b6a73b69-5ef4-4011-b0f6-928b054ffa1e\Blink.cpp.o -LC:\Users\mawilhel\AppData\Local\Temp\build-b6a73b69-5ef4-4011-b0f6-928b054ffa1e -LC:\UECIDE\cache\chipKIT-Git\HelvePic32 -Wl,--start-group -lCore_api -Wl,--end-group -lm 
C:\UECIDE\compilers\pic32-tools-MZ/bin/pic32-objcopy -O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0 C:\Users\mawilhel\AppData\Local\Temp\build-b6a73b69-5ef4-4011-b0f6-928b054ffa1e/Blink.elf C:\Users\mawilhel\AppData\Local\Temp\build-b6a73b69-5ef4-4011-b0f6-928b054ffa1e/Blink.eep 
C:\UECIDE\compilers\pic32-tools-MZ/bin/pic32-bin2hex -a C:\Users\mawilhel\AppData\Local\Temp\build-b6a73b69-5ef4-4011-b0f6-928b054ffa1e/Blink.elf 
Compiling done.
Memory usage
C:\UECIDE\compilers\pic32-tools-MZ/bin/pic32-size C:\Users\mawilhel\AppData\Local\Temp\build-b6a73b69-5ef4-4011-b0f6-928b054ffa1e/Blink.elf 
• Program size: 0 bytes
• Memory size: 0 bytes
• Compilation took 0.698 seconds
Uploading firmware...
• Resetting board...
• Uploading...
C:\UECIDE\cores\chipKIT-Git/tools/windows/avrdude -V -p32MX270F256B -P\\.\COM47 -b115200 -CC:\UECIDE\cores\chipKIT-Git/tools/windows/avrdude.conf -cstk500v2 -Uflash:w:Blink.hex:i -v 

avrdude: Version 5.10, compiled on Jan 19 2010 at 10:45:23
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2009 Joerg Wunsch

         System wide configuration file is "C:\UECIDE\cores\chipKIT-Git/tools/windows/avrdude.conf"

         Using Port                    : \\.\COM47
         Using Programmer              : stk500v2
         Overriding Baud Rate          : 115200
         AVR Part                      : 32MX270F256B
         Chip Erase delay              : 9000 us
         PAGEL                         : PD7
         BS2                           : PA0
         RESET disposition             : dedicated
         RETRY pulse                   : SCK
         serial program mode           : yes
         parallel program mode         : yes
         Timeout                       : 200
         StabDelay                     : 100
         CmdexeDelay                   : 25
         SyncLoops                     : 32
         ByteDelay                     : 0
         PollIndex                     : 3
         PollValue                     : 0x53
         Memory Detail                 :

                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom        65    10     8    0 no       4096    8      0  9000  9000 0x00 0x00
           flash         65    10   128    0 yes    131072  256    512  4500  4500 0xff 0xff
           lock           0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           lfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           efuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

         Programmer Type : STK500V2
         Description     : Atmel STK500 Version 2.x firmware
         Programmer Model: STK500
         Hardware Version: 0
         Firmware Version Master : 0.00
         Topcard         : Unknown
         Vtarget         : 0.0 V
         SCK period      : 0.1 us
         Varef           : 0.0 V
         Oscillator      : Off

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x504943
avrdude: NOTE: FLASH memory has been specified, an erase cycle will be performed
         To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file "Blink.hex"
avrdude: writing flash (9780 bytes):

Writing | ################################################## | 100% 1.30s

avrdude: 9780 bytes of flash written

avrdude done.  Thank you.

• Resetting board...
• Upload Complete
The LED is blinking !!!
I am only a bit puzzled by the program size and memeory size being reports as 0

I assume it is safe to remove the non-git compiler

Ciao, Mathias

User avatar
majenko
Site Admin
Posts: 2164
Joined: Wed Nov 09, 2011 7:51 pm
Location: UK
Contact:

Re: 50Mhz processor upgrade

Post by majenko » Mon Mar 23, 2015 12:44 pm

The size is reported as 0 because the output from the new compiler's "size" command changed from the older version. It's not being parsed right is all.
Why not visit my shop? http://majenko.co.uk/catalog
Universal IDE: http://uecide.org
"I was trying to find out if it was possible to only eat one Jaffa Cake. I had to abandon the experiment because I ran out of Jaffa Cakes".

nroff-man
Posts: 40
Joined: Wed Oct 01, 2014 6:05 pm

Re: 50Mhz processor upgrade

Post by nroff-man » Mon Mar 23, 2015 1:19 pm

Hi

Make sure you set the project oscillator to 48 MHz otherwise the timing
will be wrong. The boot loader should set the clock to 48000000.

Bye

Post Reply