NHS3152 ports are not working well

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

NHS3152 ports are not working well

663 Views
hjseong
Contributor I

Hi

I bought NHS3152DBUL and LPC_LINK2, I debugged nhs31xx SDK(release_mra2_12_1_nhs3152)

app_demo_dp_blinky project to NHS3152 using LPCXpresso IDE after connecting NHS3152 and LPC_LINK2. 

(Before debugging, I imported all projects and libraries in the SDK folder and set MCU setting -> NHS3152)

Below is mainblinky.c code.


#include "board.h"

int main(void)
{
    Board_Init();

    /* Optional feature: send the ARM clock to PIO0_1 */
    Chip_IOCON_SetPinConfig(NSS_IOCON, IOCON_PIO0_1, IOCON_FUNC_1);
    Chip_Clock_Clkout_SetClockSource(CLOCK_CLKOUTSOURCE_SYSTEM);

    /* Blink with a period of 250ms+250ms, or 2Hz */
    while (1) {
        LED_Toggle(LED_RED);
        Chip_Clock_System_BusyWait_ms(250);
    }

    return 0;
}

Debugging itself is well done.

I checked blinking by connecting LED to GND and each port.

According to this code, LED connected to PIO0_1 should blink in 2Hz, but LED connected to PIO0_7 is the one blinking not PIO0_1.

I also tried to change code from PIO0_1 to PIO0_0,2,6 but all these case, PIO0_7 is the only one blinking.

ex)    Chip_IOCON_SetPinConfig(NSS_IOCON, IOCON_PIO0_2, IOCON_FUNC_1); // change port to PIO0_2

and I tried to DAC using ANA0_0,1,2 port from example 1(in firmware example)

I modified c file mainblinky.c in app_demo_dp_blinky project.

#include "board.h"

int main(void)
{
    Board_Init();

    /* Optional feature: send the ARM clock to PIO0_1 */

    Chip_IOCON_SetPinConfig(NSS_IOCON, IOCON_ANA0_0, IOCON_FUNC_1);
      Chip_ADCDAC_Init(NSS_ADCDAC0);
      Chip_ADCDAC_SetMuxDAC(NSS_ADCDAC0, ADCDAC_IO_ANA0_0);
      Chip_ADCDAC_SetModeDAC(NSS_ADCDAC0, ADCDAC_CONTINUOUS);
      Chip_ADCDAC_WriteOutputDAC(NSS_ADCDAC0, 3000);
      while(1){}

    return 0;
}

I also tried to change  ADCDAC_CONTINUOUS to  ADCDAC_SINGLE_SHOT but even two cases are not working(voltage between Analog port and GND is always zero. LED is also not working)

app_demo_dp_tlogger is working well. if I debuged this project and taged my nhs3152 board to smartphone, temperature is read well.

I couldn't find situation like me in the NXP community. TT

So I want to know,

1. why digital port PIO0_7 is working only??

2. How to make code to control digital port and analog port?? I want to set PIO0_1 in high state(3.3V) and set ANA0_1 to 1V.

If possible, I want to get example whole code(c file like mainblinky.c) or project.

0 Kudos
1 Reply

524 Views
Kan_Li
NXP TechSupport
NXP TechSupport

1. why digital port PIO0_7 is working only??

- Because the project set PIO0_7 as the LED_RED, so you have to modify somewhere else. Please refer to the following for details.

pastedImage_2.png

2. How to make code to control digital port and analog port?? I want to set PIO0_1 in high state(3.3V) and set ANA0_1 to 1V.

-Actually I copied your code and tested it on my side, the result is 1.3126V on AN0, please refer to the following for details.

pastedImage_3.png

pastedImage_4.png

pastedImage_5.png

Is there any difference from your settings?

Have a great day,
Kan

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos