Announcement

Collapse
No announcement yet.

Serial write program to flash

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Serial write program to flash

    I am trying to send a program over serial to flashbank 1. I use flash_WriteBlock and have confirmed that it is indeed writing to flashbank 1. It is always registered as an invalid program when I call flash_Run(1). After I compile in the IDE my assumption is that I should be able to send, via serial, the .bin file the flashbank of my choosing and then run that program, but that is not working for me.

    I did read that a valid program has a header of 0x55AA, which the .bin files don't have. Is this something the IDE does when programming the display?

    I did look through the forum for information regarding sending a program via serial, but didn't manage to find anything. Any information regarding what file I need to send, and how to send it would be greatly appreciated.

  • #2
    Hello,

    You could try using the .4XE instead of the .BIN, The .4XE will contain the 0x55AA header and will work with flash_run(1)

    Best regards

    Paul

    Comment


    • #3
      When I try to run the .4xe I have written with flash_WriteBlock() it returns that the program is invalid. I send the .4xe (930Bytes) via serial and then use flash_WriteBlock() to write the serial buffer to flash bank 1. The first 256 byes of the .4xe are
      AA550391 000B0000 00000000 00000000 681C0124 00440053
      74617274 00456E64 0042472E 44617400 42472E47 6369004C
      6F61645F 4261722E 44617400 4C6F6164 5F426172 2E476369
      00657468 2E446174 00657468 2E476369 0049636F 6E732E44
      61740049 636F6E73 2E476369 00426163 6B2E4461 74004261
      636B2E47 63690050 53412E44 61740050 53412E47 63690073
      6C696465 722E4461 7400736C 69646572 2E476369 00646566
      61756C74 732E4461 74006465 6661756C 74732E47 63690054
      72656242 6F6C642E 64303100 54726562 426F6C64 2E673031
      00547265 62426F6C 642E6430 32005472 6562426F 6C642E67
      30320054 5245424D

      but when I print the first 256 byes of flash bank 1 I get the printout in the attached image, which isn't quite the same. I have verified that flash bank 1 gets erased before I write to it. What am I doing wring?
      Attached Files

      Comment


      • #4
        I got it working by writing the .4xe to the sd card, and then calling flash_LoadFile()

        Comment


        • #5
          Hello,

          It is not quite the same. I would guess that it is the serial transfer that is causing the issue, Could you check the contents of the buffer by printing that to the display and compare it with the data you sent. You could also try a different baud rate to see if that helps with the transfer if the transfer is the problem.

          Best regards

          Paul

          Comment


          • #6
            Thats great news. Thank you for letting me know.

            Best regards

            Paul

            Comment


            • #7
              I tried everything you said. The .4xe file has the header, part of which is 0x00000000 00000000 and at the end of the file is a character, which when the program gets loaded that character gets placed somewhere in the set of 0's in the header. Copying the serial buffer directly to the flashbank doesn't place the last bite of the .4xe into the header

              Comment


              • #8
                You haven't said how you are loading the .4xe using writeBlock, or if you are checking the writes for errors.

                You need to write the first block last as the first block identifies that the flashbank is to become an executable and executable banks are protected (at least the executable part of them) from writing to guard against inadvertent corruption.
                Mark

                Comment

                Working...
                X