added config flash stuff

This commit is contained in:
2025-06-07 08:01:52 -05:00
parent 6e4aa1230a
commit 68a4ed1428
18 changed files with 631 additions and 30 deletions

View File

@@ -8,6 +8,7 @@ ACK_MSG = 4
NACK_MSG = 5
AXI_WRITE_REG_BURST = 6
RF_SPI_WRITE = 7
CONFIG_FLASH_WRITE = 8
SET_AD9081_DAC_NCO = 128
SET_AD9081_ADC_NCO = 129
SET_LANE_MAP = 130
@@ -92,8 +93,22 @@ class WriteRegBurstType(Structure):
("data", c_uint32 * MAX_BURST_LENGTH)
]
def __init__(self):
init_header(self, AXI_WRITE_REG_BURST)
def __init__(self, msg_id=AXI_WRITE_REG_BURST):
init_header(self, msg_id)
self.address = 0
self.length = 0
class ConfigFlashWriteType(Structure):
_pack_ = 1
_fields_ = [
("header", Header),
("address", c_uint32),
("length", c_uint32),
("data", c_uint8 * MAX_BURST_LENGTH)
]
def __init__(self, msg_id=CONFIG_FLASH_WRITE):
init_header(self, msg_id)
self.address = 0
self.length = 0

View File

@@ -244,6 +244,21 @@ class RadarManager:
return
def config_flash_write(self, address, data):
# Make sure address is word aligned
address -= (address % 4)
# Form message
msg = msg_types.ConfigFlashWriteType(msg_id=msg_types.CONFIG_FLASH_WRITE)
msg.address = address
msg.length = len(data)
for i in range(len(data)):
msg.data[i] = data[i]
self.send_message(msg)
return
def load_waveform(self, ch, amp, bw, pw):
# addr = 0x0010000 + 0x0010000 * ch

View File

@@ -2,6 +2,7 @@ import ctypes
import time
import numpy as np
from matplotlib import pyplot as plt
import ipaddress
import data_structures
import radar_manager
@@ -28,7 +29,7 @@ def db20n(x):
def main():
print('Hello')
radar = radar_manager.RadarManager()
radar = radar_manager.RadarManager(host='192.168.1.201', port=5002)
clk = radar_manager.TIMING_ENGINE_FREQ
@@ -41,6 +42,14 @@ def main():
radar.ad9081_write_reg(0x0A0A, 0x60)
print(hex(radar.ad9081_read_reg(0x0A0A)))
# Program Config Flash IP Address
ip = ipaddress.IPv4Address('192.168.1.201')
mask = ipaddress.IPv4Address('255.255.255.0')
gw = ipaddress.IPv4Address('192.168.1.1')
port = 5002
data = bytes(np.array([ip, mask, gw, port], dtype=np.uint32))
radar.config_flash_write(0xf00000, data)
# CPI Parameters (timing values are in clk ticks)
num_pulses = 128