- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
In altera manual for transceiver custom phy ip, it is mentioned that it is possible to set up serial loopback by setting register equal to 1 at phy-mgmt_address 0x061. I have seen a tutorial at YouTube where the instructor do it using Transciever toolkit option of Quartus 2 but for that I need USB blaster cable which I dont have.
Here is the link to that tutorial
https://www.youtube.com/watch?v=vjeMWJ-mNaw
Now, is there any other way to write 1 to this register? I tried following c program to do this but it shows me segmentation error.
Any help please, if there is any other way except usb blaster cable to do this task..
Here is my c code
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdint.h>
#include <fcntl.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <sys/stat.h>
#include "C:\altera\15.1\embedded\ip\altera\hps\altera_hps\hwlib\include\hwlib.h"
#include "C:\altera\15.1\embedded\ip\altera\hps\altera_hps\hwlib\include\soc_cv_av\socal\socal.h"
#include "C:\altera\15.1\embedded\ip\altera\hps\altera_hps\hwlib\include\soc_cv_av\socal\hps.h"
#include "C:\altera\15.1\embedded\ip\altera\hps\altera_hps\hwlib\include\soc_cv_av\socal\alt_gpio.h"
#include "D:\masterarbeit3\HWXCVRHW2\hps_0.h"
#define REG_BASE 0xFF200000 /*LWFPGA SLAVE Address*/
#define REG_SPAN 0x00200000
#define serial_loopback 0x061 /*phy_mgmt_address for serial loopback*/
volatile unsigned int *xcvr_addr; /*this is the pointer that will read from transceiver*/
volatile unsigned int *xcvr_addr_serial_loopback;
void* virtual_base; /*pointer to open device memory file*/
int main ()
{
int fd = EXIT_FAILURE;
fd=open("/dev/mem",(O_RDWR|O_SYNC));
if (fd < 0) {
perror("open");
exit(EXIT_FAILURE);
}
/*setting serial loopback of transceiver by setting register 1 at address 0x061*/
xcvr_addr_serial_loopback = (unsigned int *) (XCVR_CUSTOM_PHY_0_BASE+serial_loopback);
*xcvr_addr_serial_loopback =1;
/*memory mapping*/
virtual_base=mmap(NULL,REG_SPAN,(PROT_READ|PROT_WRITE),MAP_SHARED,fd,REG_BASE);
xcvr_addr = (unsigned int *) (virtual_base+XCVR_CUSTOM_PHY_0_BASE); /*accessing base address of xcvr*/
while(1)
{
printf("pointer value is %d\n", *xcvr_addr);
}
return 0;
}
Here is the header file that contains address of my transceiver,
#ifndef _ALTERA_HPS_0_H_
#define _ALTERA_HPS_0_H_
/*
* This file was automatically generated by the swinfo2header utility.
*
* Created from SOPC Builder system 'soc_system' in
* file 'soc_system.sopcinfo'.
*/
/*
* This file contains macros for module 'hps_0' and devices
* connected to the following master:
* h2f_lw_axi_master
*
* Do not include this header file and another header file created for a
* different module or master group at the same time.
* Doing so may result in duplicate macro names.
* Instead, use the system header file which has macros with unique names.
*/
/*
* Macros for device 'xcvr_custom_phy_0', class 'altera_xcvr_custom_phy'
* The macros are prefixed with 'XCVR_CUSTOM_PHY_0_'.
* The prefix is the slave descriptor.
*/
#define XCVR_CUSTOM_PHY_0_COMPONENT_TYPE altera_xcvr_custom_phy
#define XCVR_CUSTOM_PHY_0_COMPONENT_NAME xcvr_custom_phy_0
#define XCVR_CUSTOM_PHY_0_BASE 0x0
#define XCVR_CUSTOM_PHY_0_SPAN 2048
#define XCVR_CUSTOM_PHY_0_END 0x7ff
#endif /* _ALTERA_HPS_0_H_ */
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hey,
Thanks a lot. The link you provided is really useful. Thanks again.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I am trying to download files on your link but I am having trouble. Are the files working for you on this link?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks you so much. i really appreciate your help and support
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page