Jump to content

Mamatchai

Members
  • Posts

    5
  • Joined

  • Last visited

Mamatchai's Achievements

Newbie

Newbie (1/4)

0

Reputation

  1. Recently an expert suggested to me that there might be a conflict occurring during function calls due to the similarity in the names of TCP and ZmodADC interrupt flags(IF). However, I haven't confirmed this yet.
  2. Hello Arthur, It is my careless mistake that I didn't express the problem clearly.My Vitis is 2021.1 and I'm working in the linux operating system.The solution you provided doesn't seem to apply to my particular case. Perhaps this is sudden, but I've uploaded the project I'm currently working on to the cloud, and anyone has access to it, as I'm unsure how to express my issue clearly, and I don't want to waste too much of your time unnecessarily.I'm very appreciate your willingness to spend your time on this. This is the original version that have the interrupt issue: This is the version that I currently working on to add the polling function in(I haven't add the polling function to the TCP buffer yet, so the project is not complete, I'll code it by myself after solved this problem.): By the way, we have a python code GET_DATA.py to debug, check the ADC data or to make sure the board is running or not by checking the USB port, the code is below: import csv import serial #SerialIn = serial.Serial("/dev/serial/by-id/usb-Digilent_Digilent_USB_Device_210393AD769A-if01-port0",115200) #"/dev/ttyUSB1"||"com1" SerialIn = serial.Serial("/dev/ttyUSB1",115200) #"/dev/ttyUSB1"||"com1" with open('ZMOD_ADC_DATA_0921.csv', 'w') as am2320_file: am2320_writer = csv.writer(am2320_file, delimiter=',') line_count=0 try: while True: while SerialIn.in_waiting: data_in = SerialIn.readline() #data_raw = data_in.decode('utf-8') #ISO-8859-1 data_raw = data_in.decode('ISO-8859-1') print(data_raw) #data_raw = str(data_raw[0:]) am2320_writer.writerow(data_raw) line_count = line_count + 1 except KeyboardInterrupt: SerialIn.close() The usage steps would be: 1. Open the terminal and key the command below: sudo python3 GET_DATA.py 2. And then burn the project into the FPGA (eclypse z7) board. 3. The terminal will show the data we xil_printf() in the project. I'm still not sure if this is the correct way to asked the question or not.If there is anything I can improve please let me know. Thank you very much and have a nice day. Mamatchai
  3. Hello Arthur, After I remove code from the functions in Zmod/baremetal/intc.c,the functionality of initializing ZmodADC has been consistently unusable.I've been trying to solve the issue of initializing the functionality of ZmodADC these past few days.This problem has been bothering me for quite some time.This is quite a strange question, I can't figure it out by myself, I feel like I still need some advice from you.Here's my main.c code. //-------------------------------------------------- // blog.csdn.net/FPGADesigner // copyright by CUIT Qi Liu // Zynq Lwip TCP Communication Test Program //-------------------------------------------------- #include "timer_intr.h" #include "sys_intr.h" #include "user_tcp.h" #include "lwip/netif.h" #include "sleep.h" //#define TRANSFER_LEN 0xB #define TIMER_LOAD_VALUE XPAR_CPU_CORTEXA9_0_CPU_CLK_FREQ_HZ / 8 //0.25S static XScuGic Intc; //GIC static XScuTimer Timer;//timer //extern volatile unsigned tcp_client_connected; //extern int tcp_trans_cnt; void start_application(void); #include "./Zmod/zmod.h" #include "./ZmodADC1410/zmodadc1410.h" #define SEND_SIZE 1463 //extern struct netif server_netif; static char val_formatted[15]; #define TRANSFER_LEN 0x5B7 // ZMOD ADC parameters #define ZMOD_ADC_BASE_ADDR XPAR_AXI_ZMODADC1410_0_S00_AXI_BASEADDR #define DMA_ADC_BASE_ADDR XPAR_AXI_DMA_ADC_BASEADDR #define IIC_BASE_ADDR XPAR_PS7_I2C_1_BASEADDR #define FLASH_ADDR_ADC 0x30 #define ZMOD_ADC_IRQ XPAR_FABRIC_AXI_ZMODADC1410_0_LIRQOUT_INTR #define DMA_ADC_IRQ XPAR_FABRIC_AXI_DMA_ADC_S2MM_INTROUT_INTR //static char sendBuffer_main[TCP_SEND_BUFSIZE]; //-------------------------------------------------- // 中斷與定時器初始化 //-------------------------------------------------- void System_Init() { Timer_init(&Timer,TIMER_LOAD_VALUE,TIMER_DEVICE_ID); Init_Intr_System(&Intc); // initial DMA interrupt system Setup_Intr_Exception(&Intc); Timer_Setup_Intr_System(&Intc,&Timer,TIMER_IRPT_INTR); Timer_start(&Timer); TcpTmrFlag = 0; } //-------------------------------------------------- // 主程序 //-------------------------------------------------- int main(void) { xil_printf("Im here~~~\n"); uint8_t channel=0; uint8_t gain=0; size_t length=TRANSFER_LEN; ZMODADC1410 adcZmod(ZMOD_ADC_BASE_ADDR, DMA_ADC_BASE_ADDR, IIC_BASE_ADDR, FLASH_ADDR_ADC, ZMOD_ADC_IRQ, DMA_ADC_IRQ); uint32_t *acqBuffer; adcZmod.setGain(channel, gain); acqBuffer = adcZmod.allocChannelsBuffer(length); adcZmod.acquireImmediatePolling(acqBuffer, length); static char time_formatted[15]; uint32_t valBuf; int16_t valCh; float val; int coo; xil_printf("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n"); struct netif *netif, server_netif; //用於lwIP網絡接口的通用數據結構 struct ip4_addr ipaddr, netmask, gw; //unsigned int //開發板的MAC地址 unsigned char mac_ethernet_address[] = { 0x00, 0x0a, 0x35, 0x00, 0x01, 0x02 }; System_Init(); netif = &server_netif; //0x50C004 xil_printf("netif = %s\tnetif = 0x%p\t&server_netif = 0x%p\n", netif, netif, &server_netif); //將4byte結構的IP地址轉換爲unsigned int IP4_ADDR(&ipaddr, 192, 168, 1, 10); //IP地址(開發板) IP4_ADDR(&netmask, 255, 255, 255, 0); //網絡掩碼 IP4_ADDR(&gw, 192, 168, 1, 1); //網關 lwip_init(); //初始化lwIP //將網絡接口添加到netif_list中 if (!xemac_add(netif, &ipaddr, &netmask, &gw, mac_ethernet_address, XPAR_XEMACPS_0_BASEADDR)) { xil_printf("Error adding N/W interface\r\n"); return -1; } xil_printf("netif_final = %s\n", netif); //NULL netif_set_default(netif); //設置默認網絡接口 netif_set_up(netif); //啓動網絡接口 tcp_send_init(); //初始化TCP PCB xil_printf("New acquisition ------------------------\r\n"); xil_printf("Ch1\tRaw\tTime\t\r\n"); // while(1) { if(TcpTmrFlag) { tcp_tmr(); TcpTmrFlag = 0; } xemacif_input(netif); //將MAC隊列中的packets傳輸到lwIP棧中 if (tcp_client_connected) { //連接成功則發送數據 xil_printf("TCP Connected"); /* for (int i = 0; i < 30; i++)// { valBuf = acqBuffer[i]; valCh = adcZmod.signedChannelData(channel, valBuf); val = adcZmod.getVoltFromSignedRaw(valCh, gain); adcZmod.formatValue(val_formatted, 1000.0*val, "mV\r\n"); //xil_printf("%d\t%s\t\r\n",i,val_formatted); strcat(sendBuffer,val_formatted); } */ //send_data(); //xil_printf("tran_cnt:%d\r\n", tcp_trans_cnt); xil_printf("Ready to send"); //strcpy(sendBuffer,""); //adcZmod.freeChannelsBuffer(acqBuffer, length); } if (tcp_client_connected==-1) { xil_printf("errorrrrr exit\r\n"); return 0; } //sleep(2); } return 0; } And if I removed the initiate part of ZmodADC uint8_t channel=0; uint8_t gain=0; size_t length=TRANSFER_LEN; ZMODADC1410 adcZmod(ZMOD_ADC_BASE_ADDR, DMA_ADC_BASE_ADDR, IIC_BASE_ADDR, FLASH_ADDR_ADC, ZMOD_ADC_IRQ, DMA_ADC_IRQ); uint32_t *acqBuffer; adcZmod.setGain(channel, gain); acqBuffer = adcZmod.allocChannelsBuffer(length); adcZmod.acquireImmediatePolling(acqBuffer, length); static char time_formatted[15]; uint32_t valBuf; int16_t valCh; float val; int coo; the code of can run successfully. In my opinion, the Eclypse Z7 may have a certain procedure to confirm the normal execution of interrupt processes. When there is any abnormality in the interrupt process, other actions will not be executed. Of course, this is my observation based on experiments, which may not be accurate. If you need any other information, please let me know. Thank you very much.
  4. Hello, about the solution you provided, it raises several questions for me. 1.Since it's the first time that I am using dereferencing, so I am not sure if I am doing it correctly. The code is all in the screenshot. The error code it gives is: Exception: At col 12: Cannot read symbol data. Value of register pc not available in the selected frame for this report issue, it prevents me from reading the data stored in the register I dereferenced. The code compiles without errors, so I suspect there might be something incorrect in my code causing this. 2.If my dereferencing method is correct, then I would like to inquire about the subsequent data packaging method. Our goal is to try if we can transmit the measurement signals received by our ADC through TCP. After receiving your guidance, we found that the problem indeed lies in the conflict of interrupt handlers. From : https://forum.digilent.com/topic/27431-is-it-possible-to-run-tcp-and-zmod_adc-on-eclypse-z7-at-the-same-time/#comment-83944). Thus, if we try to do something further, can you give us some advice or tell us what to do so that we can continue working on our project.
  5. Hello, As title, I'm looking to address certain technical issues through this method, but I couldn't find relevant information online. By the way, the location I want to read is ZMODADC1410_REG_ADDR_TRIG. Thanks for helping me!!!
×
×
  • Create New...