Announcement

Collapse
No announcement yet.

micro SD card

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

  • #16
    I'll check that and will let you know.

    When i use the instruction set for the fonts, step by step, i take notes for each font, for the Hexadecimal 2 bytes. I do exactly what the documents says.

    Then i put the display back to the test circuit. But i cannot set any new font from the SD. I know that it might be something i miss and will be really simple to solve it.

    I need to mention that i also use a small .wav file from the SD.

    Comment


    • #17
      Hi,

      The returned handle after loading the font can be different which is why it is necessary to read the handle that is sent back from the display and use it for setting the font. Also take care on how many fonts you load as they will consume memory.

      The .wav shouldn't affect this

      Best regards

      Paul

      Comment


      • #18
        Hi Paul,

        first of all, i need to thank you, replying on my questions and problems regarding the Fonts from the uSD.

        Please check the following configuration on the 32PTU when i set the fonts from the uSD using Serial Commander PICASO tool.

        Code:
        gfx_Cls[FFCD ] 0,017 (ACK)
        file_Mount[FF03 ] 0,108 (ACK 5451 0x154B)
        file_LoadImageControl[0009 "FONTST~2.d01" "FONTST~2.g01" 0001] 0,033 (ACK 5148 0x141C)
        file_LoadImageControl[0009 "FONTST~2.d02" "FONTST~2.g02" 0001] 0,038 (ACK 4845 0x12ED)
        file_LoadImageControl[0009 "FONTST~2.d03" "FONTST~2.g03" 0001] 0,037 (ACK 4542 0x11BE)
        file_LoadImageControl[0009 "FONTST~2.d04" "FONTST~2.g04" 0001] 0,039 (ACK 4239 0x108F)
        file_LoadImageControl[0009 "FONTST~2.d05" "FONTST~2.g05" 0001] 0,042 (ACK 3936 0x0F60)
        file_LoadImageControl[0009 "FONTST~2.d06" "FONTST~2.g06" 0001] 0,038 (ACK 3633 0x0E31)
        file_LoadImageControl[0009 "FONTST~2.d07" "FONTST~2.g07" 0001] 0,040 (ACK 3330 0x0D02)
        file_LoadImageControl[0009 "FONTST~2.d08" "FONTST~2.g08" 0001] 0,045 (ACK 3027 0x0BD3)
        txt_FontID[FFE5 0D02] 0,003 (ACK 2 0x0002)
        putstr[0018 "TEST FONT 3330"] 0,028 (ACK 14 0x000E)
        Inside the tool, the test i did works just fine. Then i do the following steps.

        i unplug the Screen from the computer usb PA5 II.

        Install the 32PTU on the testboard.

        And i use the following commands.

        Code:
        HSEROUT2 [$FF,$03] ' MOUNT FILE, this is very imporntat command in here. 
        Hserin2 [wait(6)]
        HSEROUT2[$00,$09,"FONTST~2.d07","FONTST~2.g07",$00,$01] ' SPE serial graphic interface - CALL FONT from SD
        Hserin2 [wait(6)]
        HSEROUT2[$FF,$E5,$0D,$02] ' SPE serial graphic interface - SET FONT
        Hserin2 [wait(6)]
        I have connected the serial terminal to my MCU and the display RX TX.

        The program stops at this point.

        TX: FF 9E 00 01 FF 03 --> this is when i set the LCD in LANDSCAPE R MODE
        RX: 06 00 02 --> the return from the LCD

        TX: 00 09 46 4F 4E 54 53 54 7E 32 2E 64 30 37 46 4F 4E 54 53 54 7E 32 2E 67 30 37 00 01 --> this is when i send the command for the FONTS.
        RX: 06 15 4B --> and this is the return, which 15 i believe is not good as it is the NAK.

        Comment


        • #19
          Hi

          The output is perfectly correct.

          RX: 06 15 4B

          06 is the ACK and the next 2 bytes 15, 4B, are the handle of the font you just loaded. This handle will not necessarily be the same as the number you observed in Serial Commander. After you have had the ACK, you will then have to get the extra 2 bytes

          So when you select the font these 2 received bytes need to be in the message you send

          HSEROUT2[$FF,$E5,$15,$4B]

          I hope this helps

          Best regards

          Paul

          Comment


          • #20
            I tried that. Didnt work,

            I tried to load all 8 fonts, one by one at a time, and i was getting the same response 06 15 4B.

            I know that i will find it, but it is driving me crazy.....

            Comment


            • #21
              Hi,

              It is important that the ACK you are waiting for corresponds to the command sent. Also if the response carries additional bytes it would be best to handle them. Waiting for an ACK is ok but if there is a NACK it wouldn't be detected.

              If for example, you send a command and the response has 3 bytes, first byte is an ACK 0x06, if the second or third byte which would be a return value of the function was also an 0x06, then this would be held in your serial buffer until you next use Hserin2 [wait(6)]. Very quickly it become out of sync and return values wouldn't correspond to the function that was called.

              When loading the font files, we know that 3 bytes are going to be sent back so we need to read all of them, the ACK being the first, if a NACK is received then the next 2 bytes won't arrive so you would have to check for that.

              I will take a look at the PIC Basic you are using to see if I can get a better understanding of how the receiving serial works.

              Best regards

              Paul

              Comment


              • #22
                Hi Paul,

                dont worry about PIC Basic, i will check that out. i think first i need to see what the response is for every single command and then i will try to solve the issue.

                I will keep you updated.

                Comment


                • #23
                  Dear all, i havent manage to use the fonts that i have placed in the uSD.

                  actually at VISI when i compile and asked the uSD the following message comes up at the end.

                  0 errors
                  0 warnings
                  1 notice
                  No Errors, code size = 21 bytes out of 14400 total
                  Initial RAM size = 202 bytes out of 14400 total
                  Program will run from ram so total initial RAM size = 223 bytes out of 14400 total

                  Do you think that this is a problem?

                  Comment


                  • #24
                    Hi,

                    No that is nothing to worry about, so long as the files have been copied to the uSD card it will be fine. You can send me your .GCI & .DAT file and I will check it for you.

                    Best regards

                    Paul

                    Comment


                    • #25
                      when i load the fonts to the uSD the files are not .DAT or .GCI, they have different extents like .d01 and .g01

                      Click image for larger version  Name:	usd files.png Views:	1 Size:	11.4 KB ID:	64687
                      I have attached a .rar file with the files are inside the uSD.

                      Comment


                      • #26
                        Thanks Yes that's correct, I tend to generalise all graphics files as GCI and DAT,

                        I will check these now.

                        Comment


                        • #27
                          Hi,

                          Yes, your font files are correct and work fine.

                          Are you able to read all serial returned bytes within your code.

                          Best regards

                          Paul

                          Comment


                          • #28
                            No im not. I've noticed the program pause on one of the returns.

                            I'm about to clear most of the code, make it as simple as possible, and leave only the part of the code for the fonts.

                            Then i will check where and why it pauses. Will post back once i have an answer.

                            Comment


                            • #29
                              I have done the steps more that 100 times.....hehehehe i feel stupid really.

                              First i connect the ulcd on the computer via the serial USB PA5ii.

                              I open the 4D System software and move to serial SPE.

                              Then responds from the LCD are:

                              Code:
                              gfx_Cls[FFCD ] 0,017 (ACK)
                              file_Mount[FF03 ] 0,114 (ACK 5451 0x154B)
                              file_LoadImageControl[0009 "FONTST.DAT" "FONTST.GCI" 0001] 0,047 (ACK 5148 0x141C)
                              I need to use the hex on my code $14,$1C

                              Before that i set the font.


                              Code:
                              gfx_Cls[FFCD ] 0,017 (ACK)
                              file_Mount[FF03 ] 0,114 (ACK 5451 0x154B)
                              file_LoadImageControl[0009 "FONTST.DAT" "FONTST.GCI" 0001] 0,047 (ACK 5148 0x141C)
                              txt_FontID[FFE5 141C] 0,004 (ACK 2 0x0002)
                              Then i test the font.

                              Code:
                              gfx_Cls[FFCD ] 0,017 (ACK)
                              file_Mount[FF03 ] 0,114 (ACK 5451 0x154B)
                              file_LoadImageControl[0009 "FONTST.DAT" "FONTST.GCI" 0001] 0,047 (ACK 5148 0x141C)
                              txt_FontID[FFE5 141C] 0,004 (ACK 2 0x0002)
                              putstr[0018 "TEST FONT"] 0,020 (ACK 9 0x0009)
                              and it works. I see the result on the ulcd. So it looks like the font is working via Serial software. So the problem is on my code.

                              First of all on the code i mount the file

                              Code:
                              HSEROUT2 [$FF,$03] ' MOUNT FILE, this is very imporntat command in here. 
                              HSERIN2 [wait(6),wait(21),wait(75)] ' this is the response from the LCD ACK 5451 or $154B
                              
                              following i use the .wav file to see if it is working and what the responses are
                              
                              HSEROUT2 [$FF,$00,$00,$46]  ' SOUND VOLUME to 70
                              HSERIN2 [wait(6)] ' i believe that only this response is back when we set this command. The same response i get from the serial terminal.
                              Pause 100
                              
                              Now problem starts in here with the following command. 
                              
                              HSEROUT2[$00,$09,"FONTST.DAT","FONTST.GCI",$00,$01] ' SPE serial graphic interface - CALL FONT from SD
                              HSERIN2[wait(6),wait(20),wait(28)] ' I think that i should wait for this response as the numbers from the serial 4D systems is ACK 5148 , or HEX 141C

                              Comment


                              • #30
                                I commented the wait for the following

                                Code:
                                HSEROUT2[$00,$09,"FONT.DAT","FONT.GCI",$00,$01] ' SPE serial graphic interface - CALL FONT from SD
                                'Hserin2 [wait(6)]
                                Pause 200
                                
                                
                                HSEROUT2[$FF,$E5,$14,$1C] ' SPE serial graphic interface - SET FONT
                                'Hserin2 [wait(6),wait(0),wait(2)]
                                and received

                                RX: 06 15 4B
                                RX: 06
                                RX: 06 00 41
                                RX: 06 00 00 15 15 15 15

                                which means the 15's are the NAK. so the command i send is not right. Or the LCD didnt get it.

                                I also read in the manual for the following:


                                Code:
                                HSEROUT2[$00,$09,"FONT.DAT","FONT.GCI",$00,$01] ' SPE serial graphic interface - CALL FONT from SD
                                HSERIN2 [wait(6)]
                                acknowledge
                                0x06: ACK byte if successful
                                Anything else implies mismatch between command and response.


                                Even i changed the ASCII to HEX and dindt work.

                                Code:
                                ' $46,$4f,$4e,$54,$2e,$44,$41,$54 = FONT.DAT (HEX to ASCII)
                                ' $46,$4f,$4e,$54,$2e,$47,$43,$49 = FONT.GCI (HEX to ASCII)
                                Code:
                                HSEROUT2[$00,$09,$46,$4f,$4e,$54,$2e,$44,$41,$54,$46,$4f,$4e,$54,$2e,$47,$43,$49,$00,$01] ' SPE serial graphic interface - CALL FONT from SD
                                HSERIN2 [wait(6)]
                                Last edited by astasuleo; 29th July 2018, 06:08 AM.

                                Comment

                                Working...
                                X