Code: Select all
// main_tile1.c
OTPPorts otp_ports = OTP_PORTS_INITIALIZER;
unsigned otp_data = 0;
otp_read(&otp_ports, 0x3fd, &otp_data, 1);
rtos_printf("Read OTP data: %X\n", otp_data);
Code: Select all
// main_tile1.c
OTPPorts otp_ports = OTP_PORTS_INITIALIZER;
unsigned otp_data = 0;
otp_read(&otp_ports, 0x3fd, &otp_data, 1);
rtos_printf("Read OTP data: %X\n", otp_data);
Code: Select all
#include <stdio.h>
#include <xcore/parallel.h>
// This header is required for port_enable() below
#include <xcore/port.h>
#include "otp3.h"
OTPPorts otp_ports = OTP_PORTS_INITIALIZER;
// And you should use otp_read_differential() with a logical address on xcore.ai:
// The following maps a physical to logical address:
// logical = (physical & 0x1f) + ((physical & 0x3c0) >> 1)
// and logical to physical:
// physical = (logical & 0x1f) + ((logical & 0x1e0) << 1)
const unsigned int otp_logical_addr = 0x1E0;
const unsigned int otp_value = 0x12345678;
unsigned data = 0;
int main(void)
{
// This call to port_enable() must be made if the application is booted with the XMOS secure boot loader
port_enable(otp_ports.otp_data_g);
for (int i = 0; i < 16 * 2; i++)
{
otp_read_differential(&otp_ports, otp_logical_addr + i, &data, 1);
printf("addr = %X, data = %X \n", otp_logical_addr + i, data);
}
return 0;
}