Home Forums TrueRNG Hardware random number generator How to change TrueRNGPro mode under Windows

This topic contains 1 reply, has 2 voices, and was last updated by  Ubld.it Staff 5 years, 7 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #2184

    Mouscap
    Member

    Most of my question is already in the topic.
    I try to change the mode by using a batch file with the “Mode” command like this :

    
    Mode Com4: Baud=110 Parity=N Data=8 Stop=1
    Mode Com4: Baud=300 Parity=N Data=8 Stop=1
    Mode Com4: Baud=110 Parity=N Data=8 Stop=1
    Mode Com4: Baud=4800 Parity=N Data=8 Stop=1
    

    But no effect…

    #2204

    Ubld.it Staff
    Moderator

    Mouscap,

    We use a python script to change the modes. Check out this blog post: https://ubld.it/how-to-use-truerngpro-with-python-in-windows-10-and-linux/

    If you scroll down a bit to the example script the mode change is happening around here:

    print('================== Debug Mode ====================')
    
    # Put the TrueRNGpro in Debug Mode
    
    # Knock Sequence
    ser.baudrate = 110
    time.sleep(0.1)
    ser.baudrate = 300
    time.sleep(0.1)
    ser.baudrate = 110
    time.sleep(0.1)
    
    # Set Mode
    ser.baudrate = 2400 # debug mode
    time.sleep(0.1)
    
    # This clears the receive buffer so we don't print binary data
    ser.flushInput()
    ser.flushInput() 
    returnline = ser.readline()
    ser.flushInput()
    
    # This labels our columns for readability
    print("RNG1 RNG2")
    print("_____ _____\n")
    
    # Loop
    for _ in range(debugloops):
     try:
     returnline = ser.readline() # Read a Line from the TrueRNGpro
     print(returnline) # Print the result to the console
     except:
     print('Read Failed!!!')
     break
    
    print('================== Normal Mode ====================\n')
    
    # Return back to Normal Mode
    
    # Knock Sequence
    ser.baudrate = 110
    time.sleep(0.1)
    ser.baudrate = 300
    time.sleep(0.1)
    ser.baudrate = 110
    time.sleep(0.1)
    
    # Set Mode
    ser.baudrate = 300 # normal mode
    time.sleep(0.1)
    ser.flushInput() 
    
    # Set Data Terminal Ready to start flow
    ser.setDTR(True) 
    
    # This clears the receive buffer so we aren't using buffered data
    ser.flushInput() 
    

    Ubld.it

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.