JN-AN-1220 having trouble setting output to off.

cancel
Showing results for 
Search instead for 
Did you mean: 

JN-AN-1220 having trouble setting output to off.

200 Views
lse
Contributor I

I have been using JN-AN-1220 as a template for my end devices to read sensors on I2C (DIO16/17) and SPI(DO0, DO1, DIO18, DIO0, DIO1).  All that works fine.  I am using DIO19 to enable battery monitoring. Below is the code I am using to turn the output off at initialize. 

#define DIO_READ_BATTERY         19     // DIO19 is for enabling battery monitoring

#define DIO_READ_BATTERY_MASK    (1 << DIO_READ_BATTERY)

 

       vAHI_DioSetDirection(0, DIO_READ_BATTERY_MASK);

       vAHI_DioSetPullup(0, DIO_READ_BATTERY_MASK);

       vAHI_DioSetOutput(0, DIO_READ_BATTERY_MASK);

I also try setting it off during the main loop but still not able to see the output turn off.  It stays high all the time.  

I read up on JN-UG-3087 that it would need to call to u32AHI_Init() to initialize the API functions and before calling to any integrated peripherals API functions.  When I search for this function inside JN-AN-1220 LightSensor, it is only called on JN517x chip but I am using JN5169.  I am not sure where to go from here.   Below is the circuit.  Any help is appreciated.

batteryMonitoringCircuit.PNG

Tags (1)
0 Kudos
1 Reply

54 Views
lse
Contributor I

Well, I had figure it out after I turn off SPI and DIO19 is working fine as digital output. 

I read more on the SPI and seems that DIO19 is SPISEL0 also.  When using SPI, SPISEL0 is always used and can't be reassigned unlike SPISEL1/2 that can be assigned to different pins.  So what I end up doing was to move the digital output to a different pin.  Hope this will help other people in their designs.