Announcement

Collapse
No announcement yet.

"Drive not Mounted" on gen4-uLCD-43DT

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

  • "Drive not Mounted" on gen4-uLCD-43DT

    Greetings,

    I am currently working on a project using the gen4-uLCD-43DT screen in an embedded system project. I created a program with the Visi environment, and I am currently testing and validating it with some custom python scripts over serial, to emulate MCU code interacting with the screen. This is what my python script is running:
    1. Clear screen
    2. Mount uSD card
    3. For loop
      1. Load program with file_LoadFunction()
      2. Call program with file_Callfunction()
      3. Exit repeat ... forever internal loop with 0x63 command
      4. mem_Free() command
    When trying to complete the for loop commands 25 times, for extensive validation testing, the screen will display the message "Drive not mounted" from the blocking code within the Visi program. This always occurs when the file_LoadFunction() command is sent on the 23rd time. The uSD card is a Kingston 16GB HC U1 (B0658-004.A00LFTS) formatted in FAT16. I haven't had any issues with it so far in terms of not being recognized by the screen or anything. I have used it in other testing and it has worked fine.

    Also, I'm running SPE2 rev 1.3 and PmmC rev 2.0 on the screen, which I believe are the latest ones, but an update might be needed.

    The way I created my code is from making a UI using the Visi-Genie environment, and then "Saving As" the program into a simple Visi program, and adding some extra code. The reason for this seemingly unnecessary workaround is that I inherited most of the programs for the screen from another colleague, and I wanted to try to re-use them, as I would have to put in a lot of work to replicate everything solely in Visi-Genie.

    The modifications I have made to the Visi program are as follows:
    • In the main() function, I added this code snippet
    if(cmd[0] == 99)
    break;
    endif

    right before the "sys_EventsResume" in the "repeat...forever" loop
    • After the first addition, I added a "return;" after the "repeat...forever"
    I included the Visi program in the attached text file due to size limitations on this post.

    Also, here is the python script I'm running to test the program:
    Code:
    import serial
    import time
    
    #open serial comport
    #change port number as indicated in device manager
    ser = serial.Serial('COM4',115200,timeout = None)
    print('Connected to port ' + ser.name)
    
    time.sleep(0.5)
    
    #Function will exit the program. Receives the hndl as the argument
    def exit_form(arg0):
    time.sleep(0.1)
    
    #Send Exit_form byte
    print('Sending Exit Command 0x63')
    ser.write(bytearray.fromhex('63'))
    
    #REad confirmation, should be 0x060000
    ans = ser.read(3)
    if ans == bytearray.fromhex('06 00 00'):
    print('Screen Exit Successfully')
    
    #Proceed with mem_Free at hndl location
    mem_rel = bytearray.fromhex('FE 5F')
    mem_rel += bytearray(arg0)
    ser.write(mem_rel)
    if print(ser.read(3)) != bytearray.fromhex('06 00 00'):
    print("Memory Release Successfull")
    
    def load_fct(arg1):
    
    #Create load command with program name
    load = bytearray.fromhex('00 08')
    fct = bytearray.fromhex(arg1)
    load += fct
    load += bytearray.fromhex('00')
    print('Loading Function: ')
    print(bytearray.fromhex(arg1))
    ser.write(load)
    
    #Read confirmation and get hndl
    mem_loc = ser.read(3)
    mem_loc = mem_loc[1:3]
    print('Program Memory Location: ')
    print(mem_loc)
    return mem_loc
    
    def call_fct(arg2):
    
    #Call function at hndl location
    call = bytearray.fromhex('00 19')
    fct_loc = bytearray(arg2)
    call += fct_loc
    call += bytearray.fromhex('00 00')
    print('Calling Function at Memory Location: ')
    print(bytearray(arg2))
    ser.write(call)
    
    
    
    #main function
    
    #clearscreen
    clrscreen = bytearray.fromhex('FF82')
    ser.write(clrscreen)
    
    #if the clear screen is accepted with 0x06, then run rest of program
    if ser.read(1) == bytearray.fromhex('06'):
    print('Successfully cleared the screen')
    
    time.sleep(0.5)
    
    #mount uSD with command 0xFE3C
    filemount = bytearray.fromhex('FE3C')
    ser.write(filemount)
    response = ser.read(3)
    
    #if the response from the mount command is 0x06 00 00, then it was not successfull
    if response != bytearray.fromhex('06 00 00'):
    print('Running uSD Visi Program......')
    
    #loop load, call, exit routine 25 times
    for x in range(25):
    print("\n")
    print(x)
    #AIDE
    program = load_fct('41 49 44 45 2E 34 58 45')
    time.sleep(0.1)
    call_fct(program)
    time.sleep(1)
    exit_form(program)
    time.sleep(1)
    I also attempted to increase the stack size with #STACK 1000 to see if that would fix it, but to no avail.

    I appreciate all the help (:
    Attached Files
    Last edited by JeffHamel; 10 July 2020, 12:08 AM.

  • #2
    Good day!

    Your issue is a bit hard to analyze since you are using SPE, a modified Genie and a python script all at the same time. Therefore, I tried to analyse this as simply an SPE project running a modified Genie project from the uSD.

    Diablo16 displays have several flash banks that you can utilize and run projects from instead of from the uSD card. Have you tried utilizing this instead of using SPE's file_Callfunction?

    Currently, this is not supported in SPE but since you're only trying to run ViSi Genie projects from SPE. It might be worth writing your own Designer project that will run programs from FlashBanks when the appropriate command from the host is received.

    Can you give this a try and let me know if you got better results?

    Best Regards,
    Juniel Cruz

    Comment

    Working...
    X