Hello All,
I am trying to implement a UART communication from PYNQ PS using python to a HC-05 module. But, I am not able to access the register_map attribute of the uartlite ip in order to send the data to HC-05.
Currently, I am using the following code that is sending random variables on my app.
Below is the python code I am using,
from pynq import Overlay
from pynq import MMIO
import time
overlay = Overlay('/home/xilinx/pynq/overlays/sample_b/test_bt_overlay.xsa')
print(overlay)
#print(f'Available IPS are: {overlay.ip_dict}')
uart_ip = overlay.axi_uartlite_0
print(uart_ip)
#print(overlay.ip_dict['axi_uartlite_0'])
#Accessing TX and RX of UART
UART_BASE_ADDR = 0x42C00000
UART_ADDR_RANGE = 0x10000
uart = MMIO(UART_BASE_ADDR, UART_ADDR_RANGE)
STATUS_REG_OFFSET = 0x08
TX_EMPTY_MASK = 0x04
TX_FIFO_OFFSET = 0x04
CTRL_REG_OFFSET = 0x0C
uart.write(CTRL_REG_OFFSET, 0x03)
time.sleep(0.01)
uart.write(CTRL_REG_OFFSET, 0x00)
def uart_send_byte(data):
while not (uart.read(STATUS_REG_OFFSET) & (TX_EMPTY_MASK)):
pass
uart.write(TX_FIFO_OFFSET, data)
var = 'H\n'
for i in var:
uart_send_byte(ord(i))
Is there any method to resolve this issue and perform communication perfectly?
And also why I am not able to access the register_map attribute in order to send the data?
The app I am using is Serial Bluetooth Terminal to observe the data being transmitted