xu316 port output current strength and input Schmitt trigger mode settings

Sub forums for various specialist XMOS applications. e.g. USB audio, motor control and robotics.
paul.yuan
Member
Posts: 9
Joined: Mon Jun 28, 2021 4:39 am

Post by paul.yuan »

I added the following:
I add the following code is added to xcore_port_impl.h
_ XCORE_ INLINE void __ xcore_ port_ set_ pad_ ctrl(resource_t __p, uint32_t __val)
{
__ xcore_ resource_ setc(__p, XS1_SETC_MODE_SETPADCTRL | (__val & 0xFFFF0000UL));
}
and I add the following code is added to my .xc file
#define LOC_ TX_ CURRENT (20)
#define LOC_ RX_ ST_ MODE (23)
#define LOC_ RORT_ PULL (18)
#define PORT_ DRV_ 02mA (0B00)
#define PORT_ DRV_ 04mA (0B01)
#define PORT_ DRV_ 08mA (0B10)
#define PORT_ DRV_ 12mA (0B11)
void set_ port_ drv4mA(out port p)
{
__ xcore_ port_ set_ pad_ ctrl(p,(PORT_DRV_04mA<<LOC_TX_CURRENT))
}
However, as long as the header file is included, an error will be reported (I compiled it under Windows10 os):
#include <xcore\port.h>
#include <xcore\_ support\xcore_ all.h>

I suspect there is a problem with the XTC 15.1.4 environment configuration:
I can see that in SetEnv.bat: diagonal lines used for folder path grading: some are left diagonal lines; some are right diagonal lines, as follows:
SET XMOS_ HOME=%HOMEDRIVE%%HOMEPATH%\.xmos
SET XCC_ C_ INCLUDE_ PATH=%~dp0target/include;%~ dp0target/include/clang
I don't know if setenv.bat (attachment) needs to be modified.
Please confirm.
Thank you.

/*****************************************The error message is as follows**************************************************************/
Checking build modules
WARNING: Required version of lib_logging is >=2.0.0 and actual version has greater major version: 3.1.1. There could be API incompatibilities.
WARNING: Required version of lib_xassert is >=2.0.0 and actual version has greater major version: 4.1.0. There could be API incompatibilities.
Using build modules: asrc_module4app_i2o2 lib_src(1.0.0) lib_xud(2.1.0) module_adat_rx module_adat_tx module_dfu module_i2c_shared module_i2c_single_port module_usb_audio lib_logging(3.1.1) lib_xassert(4.1.0) module_locks
Analyzing audiohw.xc
In file included from ../src/extensions/audiohw.xc:5:
In file included from C:\Program Files (x86)\XMOS\XTC\15.1.4\target\include\xcore\port.h:10:
C:\Program Files (x86)\XMOS\XTC\15.1.4\target\include\xcore/_support/xcore_common.h:28:1: error: parse error before "asm"
asm (".globalresource 0x0,\"lib_xcore\",\"global\"");
^
In file included from ../src/extensions/audiohw.xc:5:
In file included from C:\Program Files (x86)\XMOS\XTC\15.1.4\target\include\xcore\port.h:11:
In file included from C:\Program Files (x86)\XMOS\XTC\15.1.4\target\include\xcore/_support/xcore_port_impl.h:13:
C:\Program Files (x86)\XMOS\XTC\15.1.4\target\include\xcore/_support/xcore_resource_impl.h:22:14: error: cannot declare pointer to function
typedef void(*__xcore_interrupt_callback_t)(void);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Program Files (x86)\XMOS\XTC\15.1.4\target\include\xcore/_support/xcore_resource_impl.h:23:14: error: cannot declare pointer to function
typedef void(*__xcore_select_callback_t)(void);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Program Files (x86)\XMOS\XTC\15.1.4\target\include\xcore/_support/xcore_resource_impl.h:27:68: error: void * pointer must be declared as unsafe
_XCORE_INLINE void __xcore_resource_setup_callback(resource_t __r, void *__data, void(*__func)(void), uint32_t __type) _XCORE_NOTHROW
... ...


Post Reply