Тёмный
No video :(

TWI and RTC DS1307 (I2C) 🔴 ATmega328P Programming #11 AVR microcontroller with Atmel Studio 

Binder Tronics
Подписаться 5 тыс.
Просмотров 9 тыс.
50% 1

Опубликовано:

 

28 авг 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 16   
@BinderTronics
@BinderTronics 3 года назад
Full playlist on the ATmega328P AVR microcontroller ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-BHryCFw2U30.html
@JLaurel
@JLaurel 2 года назад
First I would like to thank you for this great series. I am new to the AVR world and Microchip Studio. I did play with Arduino IDE for many years. Now I try to level up and learn programming microchips using C language together with Microchip Studio. I am using an Arduino UNO with a Pocket AVR Programmer through the SPI pins to complete your tutorials. It works fine, I'm learning a lot of new stuff from your videos, including how to read a datasheet... I also added an LCD on the TWI (I2C) bus and it works fine with the DS3231 RTC module. But I did encounter a problem that I can't understand. I try to set the time in the RTC module and I get error 1 and sometimes error 2 when I try to write to TWI. I do read the time at the same time and I guess it collides with the read request. Not sure what happens. Maybe you can point me to what can be done to avoid errors and be able to safely save the desired time in the RTC module. Sometimes it works and that gives me the impression it's about the timing of the requests read/write (also LCD it's on the TWI bus)
@BinderTronics
@BinderTronics 2 года назад
Have you got pull-ups on the SDA and SCL lines and what is the resistance value? A read must finish before a write can happen and vice versa. Do the two devices work fine when separated?
@JLaurel
@JLaurel 2 года назад
@@BinderTronics Thank you for your reply. The LCD has a backpack, I believe it has pull-ups, the RTC module it's a DS3231 Module and it has pull-ups. The modules work well separately and many times work together. I have a bad implementation to update the LCD, I update it each 200ms in the main function, while I try to write the time in the RTC module. Can it be this the reason? The error it's for the twi_start(); I will change the way I update the LCD and let you know if there are any improvements. Thank you again.
@JLaurel
@JLaurel 2 года назад
@@BinderTronics I did the necessary changes and it works without any problems. It was soo stupid of me to update the LCD function each 100ms when was no need. Now I don't display the stored time while I edit the time, and I update the LCD only when I press the button after I update the new time variable. Now works fine. Thank you again for the nice series. P.S. Do you still plan to shut some new videos? What about external EEPROM, SPI communication between 2 ATmega328?
@BinderTronics
@BinderTronics 2 года назад
I think your issue is that both modules have pull-ups on them and you are connecting them in parallel. For 400k you need a value of 4k7 ohm. If you got two modules both with 4k7 pull-ups. Then you would only have 2k35 as your pull-ups value. For 100k the required value is 2k2. You can not run code in parallel on a ATmega328 (It does not have a RTOS). You can only executer code in the wrong order. At best you can do TDM that allows you to skip blocks of code based on a time interval (Like the timer video).
@BinderTronics
@BinderTronics 2 года назад
External EEPROM ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-_XSJn9KIxJ4.html . MCU does not matter I2C = TWI and the protocol is standardized. I did try ATmega328 to ATmega328 SPI communication but ended up bricking the slave MCU into a state that is unrecoverable. So I caned the idea. It is a exceedingly rare to need a MCU to MCU communication over SPI. Second finding a SPI slave device that operates on 5V is rare or expensive. I do wish to amend the series with 2 more topics but this have proven to be to time consuming to keep a consistent upload schedule.
@shelsiotomas3263
@shelsiotomas3263 Год назад
Great Work...
@noithugian494
@noithugian494 9 месяцев назад
What is circuit drawing software?
@BinderTronics
@BinderTronics 9 месяцев назад
Diptrace. KiCAD is better and it is free.
@furkanozata6775
@furkanozata6775 Год назад
Hi, I'm referencing your video. i have at32uc3c1512 mcu. and DS3231 rtc modül when i build my project. i have an error. Itis about twi register description i think. can you help me at this point ? Error : lvalue required as left operand of assignment Related Code snippet : TWIM_CR = (1
@BinderTronics
@BinderTronics Год назад
You got a `if` , `for` or `while` somewhere in your code that is using a equals operator (=) instead of a equivalent operator (==). Other way to put this. You are using a assignment operator where you should be using a logic operator. if(a = b) should be if(a == b) There is nothing wrong with the snippet you have shown unless there is something wrong in the macros. Think you are looking for the issue in the wrong place.
@furkanozata6775
@furkanozata6775 Год назад
@@BinderTronics i think there is something in macros. but i can not find a reference for at32uc3c and twim peripheral?
@BinderTronics
@BinderTronics Год назад
ww1.microchip.com/downloads/en/DeviceDoc/doc32117.pdf 27.9 User Interface try TWIM_CR = (1
@furkanozata6775
@furkanozata6775 Год назад
@@BinderTronics Thanks for your valuable help.
Далее
New Dyna Skin is OP🥵🔥 | Brawl Stars
00:16
Просмотров 305 тыс.
I Built a WATERPARK In My House!
26:28
Просмотров 21 млн
Кого из блогеров узнали?
00:10
Просмотров 547 тыс.
RS232 interface with the 6551 UART
22:45
Просмотров 203 тыс.
Bare-Metal MCU #8: Optimizers and Bit-Banging
16:57
Просмотров 22 тыс.
AVR Programming - AVR Dragon Introduction
13:23
Просмотров 102 тыс.
I2C Hardware & PCB Design - Phil's Lab #132
34:50
Просмотров 40 тыс.