First time trying to read a peripheral register, so I'm not confident I'm doing it right.
I'm trying to read the general oscillator control register.
The oscillator is peripheral 4, and the general oscillator control register is at base address 0.
The problem is the following code hangs when it enters read_periph_8.
unsigned char read_vals[1];
read_periph_8(tile[0],4,0,1,read_vals);
Any idea why it hangs?
Can't read a peripheral register.
-
- Experienced Member
- Posts: 94
- Joined: Sun Feb 10, 2013 4:47 am
-
- Experienced Member
- Posts: 94
- Joined: Sun Feb 10, 2013 4:47 am
Found the problem.
I needed to use the usb_tile, not tile[0].
read_periph_8(usb_tile,4,0,1,read_vals);
I needed to use the usb_tile, not tile[0].
read_periph_8(usb_tile,4,0,1,read_vals);
-
- Experienced Member
- Posts: 94
- Joined: Sun Feb 10, 2013 4:47 am
Actually, using usb_tile just stopped the hanging. It appears that usb_tile is not the correct tile to look for the oscillator control register.
-
- Experienced Member
- Posts: 94
- Joined: Sun Feb 10, 2013 4:47 am
After studying app_adc_demo_u in sc_u_series_support-master, the solution was to set the target in the makefile as follows:
TARGET = XP-SKC-SU1.xn
This somehow creates a global xs1_su that represents the peripheral tile and can be used as follows:
read_periph_8(xs1_su,XS1_SU_PER_OSC_CHANEND_NUM,XS1_SU_PER_OSC_ON_SI_CTRL_NUM,1,reg_val);
TARGET = XP-SKC-SU1.xn
This somehow creates a global xs1_su that represents the peripheral tile and can be used as follows:
read_periph_8(xs1_su,XS1_SU_PER_OSC_CHANEND_NUM,XS1_SU_PER_OSC_ON_SI_CTRL_NUM,1,reg_val);
-
- XCore Legend
- Posts: 1126
- Joined: Thu May 27, 2010 10:08 am
Yes - the xn file gets compiled into a .h file called platform.h which makes the node identifiers available in your source code.TARGET = XP-SKC-SU1.xn
This somehow creates a global xs1_su that represents the peripheral tile and can be used as follows
However, I would have expected
Code: Select all
usb_tile
Code: Select all
<Node Id="1" InPackageId="1" Type="periph:XS1-SU" Reference="usb_tile" Oscillator="24MHz">
<Service Proto="xs1_su_adc_service(chanend c_adc)">
-
- Member++
- Posts: 24
- Joined: Thu Aug 14, 2014 10:55 am
I am just curious to know whether it is possible to see the "platform.h" file auto-generated from .xn file? (Forgive me as this question is off from the thread topic)
-
- XCore Expert
- Posts: 754
- Joined: Thu Dec 10, 2009 6:56 pm
You can use the -save-temps compiler option to save all intermediate files, including the platform.hkrishnabalan wrote:I am just curious to know whether it is possible to see the "platform.h" file auto-generated from .xn file? (Forgive me as this question is off from the thread topic)