nhs3152lpcxpresso sdk
Hello, I want to use nhs3152's spi interface to communicate ADS1292R(from TI). But when I set the setting as User's guide, I found that the SPI driver isn't work as I hope. Here are my settings:
/* SSP initialization */
Init_SSP_PinMux();
Chip_SSP_Init(NSS_SSP);
ssp_format.frameFormat = SSP_FRAME_FORMAT_SPI;
ssp_format.bits = SSP_DATA_BITS;
ssp_format.clockMode = SSP_CLOCK_MODE0;
Chip_SSP_SetMaster(NSS_SSP, SSP_MODE_TEST);
Chip_SSP_SetFormat(NSS_SSP, ssp_format.bits, ssp_format.frameFormat, ssp_format.clockMode);
Chip_SSP_SetBitRate(NSS_SSP, 100000);
Buffer_Init();
/* Setup SSP buffer */
xf_setup.length = BUFFER_SIZE;
xf_setup.tx_data = Tx_Buf;
xf_setup.rx_data = Rx_Buf;
xf_setup.rx_cnt = xf_setup.tx_cnt = 0;
It would always run to a error condition which shows Overun.
Hi,
Can you compare your code with the example code snippets listed in the documentation? See <SDK>/docs/firmware.html, NHS31xx SW API > Modules > Drivers > ssp: Serial Peripheral Interface / Synchronous Serial Port controller, scroll down to example 1 and example 2.
Best,
Dries.
Hi, I don't know why. But when I check the pin's voltage, it seems that voltage is just about 1V. After changed another nhs3152 chip, the output is back to 2.7V.
For application reason, I need to simulate SPI through GPIO now. Unfortunately, using some configurations like example does not actuate pins.
some pins don't work at all, some start working, however, the voltage is 1+V. the configuration is as follows:
Chip_Clock_System_SetClockFreq(NSS_SFRO_FREQUENCY/2);
Board_Init();
Chip_IOCON_SetPinConfig(NSS_IOCON, IOCON_PIO0_8, IOCON_FUNC_0 |IOCON_RMODE_INACT); /* MISO */
Chip_IOCON_SetPinConfig(NSS_IOCON, IOCON_PIO0_9, IOCON_FUNC_0 |IOCON_RMODE_INACT); /* MOSI */
Chip_IOCON_SetPinConfig(NSS_IOCON, IOCON_PIO0_2, IOCON_FUNC_0 |IOCON_RMODE_INACT); /* SSEL */
Chip_IOCON_SetPinConfig(NSS_IOCON, IOCON_PIO0_6, IOCON_FUNC_0 |IOCON_RMODE_INACT); /* SCLK */
Chip_GPIO_SetPinDIRInput(NSS_GPIO, Pinport, MISO);
Chip_GPIO_SetPinDIROutput(NSS_GPIO, Pinport, MOSI);
Set_MOSI_Low; //define to set counterpart pin to the value I need
Chip_GPIO_SetPinDIROutput(NSS_GPIO, Pinport, SSEL);
Set_SSEL_High;
Chip_GPIO_SetPinDIROutput(NSS_GPIO, Pinport, SCLK);
Set_SCLK_Low;
May my answer will help you.
Regards,
Lee
Hi,
You can run a simple test using a GPIO.
For example the led.c
Chip_IOCON_SetPinConfig(NSS_IOCON, sLeds[n].pio, IOCON_FUNC_0 | IOCON_RMODE_INACT);
Chip_GPIO_SetPinDIROutput(NSS_GPIO, sLeds[n].port, sLeds[n].pin);
Chip_GPIO_SetPinState(NSS_GPIO, sLeds[n].port, sLeds[n].pin, ((states >> n) & 1) == sLeds[n].polarity);
Regards,
Mario
Hi, I don't know why. But when I check the pin's voltage, it seems that voltage is just about 1V. After changed another nhs3152 chip, the output is back to 2.7V.
For application reason, I need to simulate SPI through GPIO now. Unfortunately, using some configurations like example does not actuate pins.
some pins don't work at all, some start working, however, the voltage is 1+V. the configuration is as follows:
Chip_Clock_System_SetClockFreq(NSS_SFRO_FREQUENCY/2);
Board_Init();
Chip_IOCON_SetPinConfig(NSS_IOCON, IOCON_PIO0_8, IOCON_FUNC_0 |IOCON_RMODE_INACT); /* MISO */
Chip_IOCON_SetPinConfig(NSS_IOCON, IOCON_PIO0_9, IOCON_FUNC_0 |IOCON_RMODE_INACT); /* MOSI */
Chip_IOCON_SetPinConfig(NSS_IOCON, IOCON_PIO0_2, IOCON_FUNC_0 |IOCON_RMODE_INACT); /* SSEL */
Chip_IOCON_SetPinConfig(NSS_IOCON, IOCON_PIO0_6, IOCON_FUNC_0 |IOCON_RMODE_INACT); /* SCLK */
Chip_GPIO_SetPinDIRInput(NSS_GPIO, Pinport, MISO);
Chip_GPIO_SetPinDIROutput(NSS_GPIO, Pinport, MOSI);
Set_MOSI_Low; //define to set counterpart pin to the value I need
Chip_GPIO_SetPinDIROutput(NSS_GPIO, Pinport, SSEL);
Set_SSEL_High;
Chip_GPIO_SetPinDIROutput(NSS_GPIO, Pinport, SCLK);
Set_SCLK_Low;
May my answer will help you.
Regards,
Lee