USART channel 1 & 3 is not working

Go To Last Post
3 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,

I have been working with samv71q21 evaluation board. I written USART Driver were channel 0 is working with both UART and spi while channel 2 & 3 are not working may I know what might be issue.

Regards,
Kishore

Last Edited: Sun. Aug 23, 2020 - 09:13 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I think you have to be more specific if you want an answer here. If you want to post some of your code, then maybe someone can help you.

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

SOLUTION: You need external and software pullup resistors on I2C_1 and I2C_2. It seems that development board doesn't them installed on I2C_1 and I2C_2. Also, you have to install the pull-up resistors before running the program.

 

I have quite a similar issue... but with I2C

 

First of all, im new to Atmel MCUs and this is my first project on atmel MCU so please bare with me :)

 

I've got a SAML21 Xplained-pro development board with SAML21J18B microcontroler on it and im trying to implement three I2C interfaces.
I've succesfuly generated an Atmel-Start project with three I2C interfaces with default configurations. To test the I2Cs I'm using function provided in the examples folder - I2C_X_example() where X is 1,2 or 3. The interfaces are properly initialized (I2C_X_Init())
The problem is only I2C0 on SERCOM 0 ( PA8, PA9) is working as it should. Other twos (I2C1:PA16,PA17 SECOM1 and I2C2:PA12,PA13 SERCOM2) are not working at all, with signal lines pulled to low.

I've tried about everything that i could remember .. hardware and software pull-up resistors, checking clock sources, initializing one at a time,.. without a success. One is working straight out of the box, the other twos are dead!

 

Can somebody please give me a hint, workaround, working code... anything!

 

im using Atmel Studio 7 (7.0.2397) running on w10, using HAL/HPL/HRI API.

 

Ive checked the code for some kind of anomalies but havent found anything (useful).. only thing that maybe caught my eye is within generated clock configuration ( I2C_X_CLOCK_init() in driver_init.c)

hri_gclk_write_PCHCTRL_reg(GCLK, SERCOM0_GCLK_ID_CORE, CONF_GCLK_SERCOM0_CORE_SRC | (1 << GCLK_PCHCTRL_CHEN_Pos));
hri_gclk_write_PCHCTRL_reg(GCLK, SERCOM0_GCLK_ID_SLOW, CONF_GCLK_SERCOM0_SLOW_SRC | (1 << GCLK_PCHCTRL_CHEN_Pos));

 

main.c

 

#include <atmel_start.h>

int main(void)
{
	atmel_start_init();

	while (1) {
		delay_ms(10);
		I2C_0_example();
		//I2C_1_example();
		//I2C_0_example();
	}
}

/* just for reference
void I2C_0_example(void) // drivers_examples.c
{
	struct io_descriptor *I2C_0_io;

	i2c_m_sync_get_io_descriptor(&I2C_0, &I2C_0_io);
	i2c_m_sync_enable(&I2C_0);
	i2c_m_sync_set_slaveaddr(&I2C_0, 0x12, I2C_M_SEVEN);
	io_write(I2C_0_io, (uint8_t *)"Hello World!", 12);
}

void I2C_1_example(void)
{
	struct io_descriptor *I2C_1_io;

	i2c_m_sync_get_io_descriptor(&I2C_1, &I2C_1_io);
	i2c_m_sync_enable(&I2C_1);
	i2c_m_sync_set_slaveaddr(&I2C_1, 0x12, I2C_M_SEVEN);
	io_write(I2C_1_io, (uint8_t *)"Hello World!", 12);
}

void I2C_2_example(void)
{
	struct io_descriptor *I2C_2_io;

	i2c_m_sync_get_io_descriptor(&I2C_2, &I2C_2_io);
	i2c_m_sync_enable(&I2C_2);
	i2c_m_sync_set_slaveaddr(&I2C_2, 0x12, I2C_M_SEVEN);
	io_write(I2C_2_io, (uint8_t *)"Hello World!", 12);
}*/

 

here are some screen shots from ASF code generation tool

 

ps. I also tried to move the clock source (dashed line on print screen 3) from clock source 3 to clock source to generic clock generator 0 (4Mhz) but without any luck.

 

SOLUTION: You need external and software pullup resistors on I2C_1 and I2C_2. It seems that development board doesn't them installed on I2C_1 and I2C_2. Also, you have to install the pull-up resistors before running the program.

 

 

 

Attachment(s): 

Last Edited: Wed. Sep 9, 2020 - 12:25 PM