SAMR21 - BitCloud I2C Problems

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

Normally I used the ATmega256rfr2 Chip, recently I bought the SAMR21 Xplained Pro to test out the chip.

I could nearly user every function I normally need, like generate network, ADC, UART and so on.

But the I2C seems to crash, when using the predefined BitCloud functions.

Did anyone else have this problem and has a solution?

As soon as I am trying to read or write something with the I2C Descriptor the board crashes and has to be reset.

Any suggestions or remarks?

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

I2C will tell you when something goes wrong if you use the return status of the functions and test for unexpected return values.

 

Jim

 

Mission: Improving the readiness of hams world wide : flinthillsradioinc.com

Interests: Ham Radio, Solar power, futures & currency trading - whats yours?

 

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

Hey Jim,

thanks for the answer!

Yes I know and I am using them. As you can see below I always check the return value of the I2C function, I do the same with the Read and Write functions.

 

			if(-1 == HAL_OpenI2cPacket(&i2cdescriptor)) {
				appWriteDataToUsart((uint8_t*)"I2C_OPEN_FAIL\n\r", sizeof("I2C_OPEN_FAIL\n\r")-1);
				appstate = APP_INIT_LM73_STATE;
				SYS_PostTask(APL_TASK_ID);
			} else 
				appWriteDataToUsart((uint8_t*)"I2C_OPEN\n\r", sizeof("I2C_OPEN\n\r")-1);

But as soon as I am trying to use the Read function of the I2C-Descriptor it literally crashes.

Does nobody have the same problems as me?

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

david.ffm wrote:
it literally crashes.

What do you mean by that?

  • It restarts from the reset vector?
  • It hangs?
  • You get a Hard Fault?
  • Other?

 

Does nobody have the same problems as me?

Note that this "ASF" forum is stupidly buried in the AVR section; so not immediately visible from the Cortex-specific forums - where the Cortex people are.

 

<rolls-eyes>

 

Hence you may be better in the specific Cortex-M forum - especially if you're getting into debugging Hard Faults...

 

Also, BitCloud topics are probaly more appropriate in the IoT section ...

 

A moderator would be able to move it.

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...