ASF4 and I2C

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

So how you connect i2c ...using asf4...there is very less api for writing 

Last Edited: Thu. Jun 10, 2021 - 01:05 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It would help if you mention what processor your target is.

 

JIm

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

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


 

 

Don't you just go to https://start.atmel.com/ and take it from there - it should all be "intuitive" ...

 

laugh

 

 

 

 

 

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...
Last Edited: Thu. Jun 10, 2021 - 01:31 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

proc SAMD21  --  asf4  -- sync or async(select in atmelstart)

i2c master does not want to transmit data, waiting for confirmation from the slave. Makes a pulse in the bus and that's it.   

 

------------INIT

 i2c_m_sync_get_io_descriptor(&I2C_0, &I2DESC);
 i2c_m_sync_enable(&I2C_0);
 i2c_m_sync_set_slaveaddr(&I2C_0, 0x49, I2C_M_SEVEN);

 

---main

delay_ms(100);

err=io_write(I2C_0, (uint8_t *)"Hello World!", 12);

or

err=i2c_m_sync_cmd_write(&I2C_0, (uint8_t)0x00, &data[0] , 12)

debug err= -4      what to do next???

 

 

Last Edited: Thu. Jun 10, 2021 - 01:59 PM