No announcement yet.

Picadillo35T and ICSP

  • Filter
  • Time
  • Show
Clear All
new posts

  • Picadillo35T and ICSP

    Hi there!
    I tried to program my display with a PICKit3 via ICSP. After the voltage configuration (Power target circuit from tool) i loaded the .hex compiled with UECIDE. Now the display don`t work and i can`t re-program it with UECIDE `cause i don`t have the bootloader. I tried to download the bootloader from the product page in the 4DSystems site but when i click the link it open a webpage with the code.
    Maybe i miss something during the process, i have not found tips or tutorial online for this.

    UECIDE v. 0.8.7z36
    TFT Library
    Picadillo35t board plugin installed

    Is right take the .hex and flash the device with it?
    My problem now, after few tries, is that the program stop during the display initialization

    void setup()
        // These set the touch screen resolution.
        programData.displayBrightness = 35;
        analogWrite(PIN_BACKLIGHT, programData.displayBrightness);
    If i change the value "programData.displayBrightness" i`ll see it after a new programming, and the fillScreen function is not executed. Did i broke in some way the display?


  • #2
    By eradicating the bootloader you also eradicated the chip's configuration and also the startup code. Under normal circumstances you need to ensure that the bootloader stays there in order to have the program even begin to execute. So you would need to merge the bootloader and your .hex file together so that they can be programmed as one.

    The other alternative is to select the pickit2 as the programmer in UECIDE. This will change the linker script used to one that doesn't require the bootloader to be there (it contains the chip config and a different addressing structure for the memory) so the resultant .hex can be run without the bootloader.

    The latest bootloader is always available from github:

    Yes, it displays it as text, but then it is just text. To get it downloaded the best way is (in github) to right-click the "Raw" button (or right click the link on the 4D website) and select "Save link as..."


    • #3
      Thanks for the answer

      I checked the selected programmer and was PicKit 2.

      I run a couple of test.
      At first i installed the bootloader downloaded from github (i downloaded the first time, size were different), then i compiled my program and i successfully programmed the board via usb (Programmer: AVRDude selected). The display was like new and the program was running.
      Second try was to change the programmer to PicKit 2, take the .hex and use the PicKit3 for programming. After uploading the program i removed the programmer and i saw my startup page. Then i unplugged the feeder (i am connected with the 5VDC adapter provided with the kit) and plugged in again. The result is the same problem. The display don`t initialize, i have the backlight programmed but the execution freeze during the initialization (the display is all black).

      Good news: the display is not broken.
      Bad news: the program don`t run as expected.

      After forced the program to start removing all the startup check i have this situation: the program is running but the display don`t work. If i put the bootloader and program the Picadillo with it all is ok, but if i try to program it without the bootloader the display remain black. But after programming the device with the PicKit3 overwriting the bootloader and the program all work until shutdown and power up.

      Any hint or suggestion?
      Last edited by coso2; 7 October 2015, 02:07 AM. Reason: Edited after other test


      • #4
        Hi there, i created a new test project, just for test the programming modes.

        This is the code:
        #include <TFT.h>
        PICadillo35t tft;
        void setup()
            analogWrite(PIN_BACKLIGHT, 36);
        void loop(){}
        Again,if i upload with AVRDude or pic32prog (so, bootloader) i see the blue screen, everything works fine. Programmed with ICSP result in a black screen.

        I noticed that, during power up, the display backlight flash several times, after that it remain stable at the set value.


        • #5
          The "good" news is I have managed to replicate your symptoms - program through USB and it's fine. Program through PK3 and it's fine. Unplug PK3 and it refuses to start.

          The "bad" news is that at the moment I am as clueless as you, but now I have some solid data to go on I'm sure we will get to the bottom of this quite quickly.


          • #6
            Aha, I see the problem. I do recall something about this from way back at the beginning of the Picadillo designs - It was decided to use a 12MHz crystal instead of an 8MHz crystal since most of the current 4D products also used a 12MHz crystal - economy of scale and all that...

            The bootloader is set to use a 12MHz crystal, but the "nobootloader" linker script is set to use an 8MHz crystal - because the "nobootloader" linker script is a generic one for all PIC32MX795 based boards, including things like the MAX32. All the other '795 boards use an 8MHz crystal - it's just the Picadillo that doesn't.

            So a custom "nobootloader" linker script is going to be needed. Not a problem, I can quickly knock one up for testing and include it in the board package.


            • #7
              Ok, I have uploaded a new board definition for the Beta version of UECIDE. If you're curious as to why it worked with the PK3 still attached, it's because when the PK3 connects to the chip for programming and debugging it forces it to operate from the internal FRC clock instead of the external crystal. That way no matter what mess you make of the config settings you are still able to reprogram the chip - unlike with an AVR chip where if you hose the fuse settings you're pretty much attached to an object by an inclined plane wrapped helically around an axis.


              • #8
                Also for future reference, these are the "official" bootloader settings for the chip:

                    DEVCFG0 = 7fffffff
                                     3 Debugger disabled
                                    18 Use PGC1/PGD1
                    DEVCFG1 = ff6acd7b
                                     3 Primary oscillator with PLL
                                    2  Secondary oscillator enabled
                                   1   Primary oscillator: XT
                                   4   CLKO output disabled
                                  0    Peripheral bus clock: SYSCLK / 1
                                  4    Fail-safe clock monitor disable
                                  8    Clock switching disable
                                 a     Watchdog postscale: 1/1024
                    DEVCFG2 = fff87ada
                                     2 PLL divider: 1/3
                                    5  PLL multiplier: 20x
                                   2   USB PLL divider: 1/3
                                       Enable USB PLL
                                 0     PLL postscaler: 1/1
                    DEVCFG3 = 3affffff
                                 7     Assign irq priority 7 to shadow set
                                       Ethernet RMII enabled
                               2       Default Ethernet i/o pins
                                       Alternate CAN i/o pins
                                       USBID pin: controlled by port
                                       VBuson pin: controlled by port