Now you can write the floats and decimal numbers to EEPROM. The latest updates to the Library will pushed to github.com/controllerstech/STM32/tree/master/EEPROM_STM32
Great tutorial! To save code and memory, I have added a define instead of the LOG calculations: #define PADDRPOSITION 5 // int PADDRPOSITION = log(PAGE_SIZE)/log(2); Needs to be modified for each EEPROM type
Great totorial! How can we use our internal flash as eeprom if we don't have an external eeprom? I have use del HAL_Flash but with takes a lot of time and I want to use to save somo data in a power off.
I love your explanations! Could you make a video of i2c slave mode on stm32 blue pill or others? It will be alsome to see how to use registers or hal. Thank you for sharing your videos
Hello, Controllers Tech! I found 2 bugs in your code while I'm working on my project. First, the code is only limited to EEPROMs that have 2-byte memory addresses like AT24C256, while 1-byte memory address EEPROMs like AT24C02 only use 1 byte as an address, which is unsupported by the hard-coded 2-byte function call. Another issue is that when you try to commit data that has a length multiple of 8, the last page will be committed as an empty page, and will, in some AT24C alternative parts, erase the next page unwantedly. I fixed these bugs in my own repository, and if you would like, I can file a pull request. Thanks!
@@kateiry4719 Thank you very much, dear friend! It really works! 🙏🙏🙏 I'm a newbie to STM32 and some things are hard for me to write myself. :) And of course thank you very much Controllers Tech!
Hi Controllers Tech, brilliant series about STM32. Could you explain why the Arduino and STM32 uses different addresses for i2c? It appears that the address on the Arduino appears to be shifted to the right by one bit. Why is this? For example, the address is 0x50 in Arduino but 0xA0 on STM32. Thanks
At the mcu level all of them use 8 bit address. There is no such thing as 7 bit register. Arduino IDE takes 7 bit (higher 7 bits) value. If you don't use the arduino functions and instead use registers for programming, you need to give 8 bit value in arduino too. I suppose they did that because the 0th bit of the i2c address denotes read or write operation. So they would want to minimise the confusion of changing address with read or write cycle..
I was trying to use your library to save the frequency values of fm module tea5767 but that don´t works at least for me , however I found other way that make it works without your library . Anyway, thanks to share knowledge
Hi can you make a video on sending data to https client by POST request using esp8266 by AT commands...As I have tried.. http work but https not.....I have studied.... Found about slip command for rest api....But not getting any reference about this with stm32 by udatt using AT commands....
i tested the code and it works but when i keep the OFFSET for datar1 [ ] zero than i can see the whole string " hello world" but when i increase the OFFSET value then the whole string moves up in live expression window although it should go down, can you please explain this
You are not keeping offset for anything, you are reading from an offset. Of course it will move up. Say your data is in 10th place. If you read with an offset 0, then the data will show at 10th place in the RXBuf. But if you read from an offset of 8, then the data will show up at 3rd place.
Hi I'm using this on stm32l4 and AT24C16 , there is a problem in multipage writing...it writes the intended content of the last page over all of the pages!!!
I have exactly the same problem with writing in 24WC16P (16 bytes/128 pages). ALL data is recorded only on the first page. But in 24C64 (32 bytes/256 pages), the recording is performed correctly. And there is also a restriction on setting the byte offset in the page being written: writing does not occur if the offset exceeds the page size (in bytes). Apparently, it is necessary in the recording function to check for the offset output beyond the number of bytes in one page and make the appropriate correction?
According to the documentation for 24C16, the addressing of memory cells is different. The highest byte of the cell address is placed in the lowest tetrad of the device address byte (excluding bit '0'). I had to change the code and it worked correctly.
Hi all! I add to write and read function "automatic calcul the page from offset" I hope it is correct. page = offset / PAGE_SIZE; offset = offset % PAGE_SIZE; Have a nice day!
EEPROM is M24C04-R. I am trying to do write page and Read page of Structure values. But it's not reading after 16byte. So provide me solution for this.
Explanation: Your EEPROM is 4kbit, in bytes that would be 4096bits/8bits = 512bytes. The datasheet says the page size is 16bytes. So, the number of pages would be 512bytes/16bytes = 32.
I love your tutorials! Unless you revert back to the OOTB/Default CubeIDE color style I'll unfortunately have no choice but to pass on the upcoming tutorials. I simply can't see anything, its all black with some light tones of gray here and there man :(( Maybe your monitor settings are very high contrast, I don't know, but here on two computers its practically non-readable. Keep up the good work, thumbs up
Noted... I'll switch to light theme... Actually never had that issue on any device i see the video on. But anyway there is no harm with light theme also
Haven't played with dark themes much to know but perhaps the font color can be brighten a bit, closer to white'ish. As-is and with those dark gray shades on black it definitely does not work for a general audience, need some seriously sharp eyesight *_* ;)
it works great when i write on one page,but when i write in 2 or more seperate page it doesn't work properly unless i write and then exactly read the next line.i dont know where i'm making a mistake. EEPROM_Write(0, 0, (uint8_t *)dataW,strlen(dataW)); EEPROM_Write(3, 0, (uint8_t *)dataW2,strlen(dataW2)); EEPROM_Read(0, 0, dataRead, 15); EEPROM_Read(3, 0, dataRead2, 15); i use at24c08.
Now you can write the floats and decimal numbers to EEPROM. The latest updates to the Library will pushed to github.com/controllerstech/STM32/tree/master/EEPROM_STM32
where do i specify data read or data write
like EEPROM_Write(1,0,dataWrite,1500);
only by using this i can see data read in live expression right?
Thank you, you saved me probably half day of work !
I just wana thank you for sharing your knowledge with us !!
Thank you, i really appreciate that!
Great tutorial!
To save code and memory, I have added a define instead of the LOG calculations:
#define PADDRPOSITION 5 // int PADDRPOSITION = log(PAGE_SIZE)/log(2);
Needs to be modified for each EEPROM type
You are awesome. Thanks for the clarity.
Great totorial! How can we use our internal flash as eeprom if we don't have an external eeprom? I have use del HAL_Flash but with takes a lot of time and I want to use to save somo data in a power off.
What a great video. Thank you for your efforts.
Thanks good video, have you ever work with spi W25Q## ??? that would be a good one too.
Hi. please make tutorial how to use the hall sensor interface driver. From hal library. To control the motor, speed and position. Thanks.
This person is a legend! Amazing content!
I love your explanations! Could you make a video of i2c slave mode on stm32 blue pill or others? It will be alsome to see how to use registers or hal.
Thank you for sharing your videos
Sure.. I'll make with HAL first
Fantastic! Thankyou
hi, thanks for your video, it helps a lot. why dont you use log2() function for paddrposition evaluating ? what's wrong with it?
I did used it.
So amazing tutorial! Thanks
Great work , as allways.
Thanks for your videos.
Hello, Controllers Tech! I found 2 bugs in your code while I'm working on my project. First, the code is only limited to EEPROMs that have 2-byte memory addresses like AT24C256, while 1-byte memory address EEPROMs like AT24C02 only use 1 byte as an address, which is unsupported by the hard-coded 2-byte function call. Another issue is that when you try to commit data that has a length multiple of 8, the last page will be committed as an empty page, and will, in some AT24C alternative parts, erase the next page unwantedly.
I fixed these bugs in my own repository, and if you would like, I can file a pull request. Thanks!
Hi, Kate Iry! Can you publish your own version of the code for AT24C02? I will be very grateful. Thanks!
@@ArsenMikitov No problem! Check out pastebin.com/vELjnicZ
@@kateiry4719 Thank you very much, dear friend! It really works! 🙏🙏🙏 I'm a newbie to STM32 and some things are hard for me to write myself. :) And of course thank you very much Controllers Tech!
@@ArsenMikitov My pleasure! Don't forget to include the HAL header file of your own MCU 😉
@@kateiry4719 Hi, I am getting error in EEPROM_pageErase like undefined symbol. Do you know how to solve .
Hi Controllers Tech, brilliant series about STM32. Could you explain why the Arduino and STM32 uses different addresses for i2c? It appears that the address on the Arduino appears to be shifted to the right by one bit. Why is this? For example, the address is 0x50 in Arduino but 0xA0 on STM32. Thanks
At the mcu level all of them use 8 bit address. There is no such thing as 7 bit register.
Arduino IDE takes 7 bit (higher 7 bits) value. If you don't use the arduino functions and instead use registers for programming, you need to give 8 bit value in arduino too.
I suppose they did that because the 0th bit of the i2c address denotes read or write operation. So they would want to minimise the confusion of changing address with read or write cycle..
I was trying to use your library to save the frequency values of fm module tea5767 but that don´t works at least for me , however I found other way that make it works without your library . Anyway, thanks to share knowledge
Very well done! Thank you!
Great work as usual 👍
Hi can you make a video on sending data to https client by POST request using esp8266 by AT commands...As I have tried.. http work but https not.....I have studied.... Found about slip command for rest api....But not getting any reference about this with stm32 by udatt using AT commands....
are these the remaining bytes of the startpage?
why do you not left shift the eeprom address by 1
thanks so much,it helps me a lot
Hi, is the library compatible also for 24AA256? Thanx.
Yes. But watch the video instead of using library. I have explained the steps in case if anything is different
i tested the code and it works but when i keep the OFFSET for datar1 [ ] zero than i can see the whole string " hello world" but when i increase the OFFSET value then the whole string moves up in live expression window although it should go down, can you please explain this
You are not keeping offset for anything, you are reading from an offset. Of course it will move up.
Say your data is in 10th place. If you read with an offset 0, then the data will show at 10th place in the RXBuf. But if you read from an offset of 8, then the data will show up at 3rd place.
can you please explain how to find the endpage with the help of offset and the size of the data
What ?
Just add the offset to the data size. Now compare with the page size. If it exceeds then you are on the next page..
This is just simple math
Hi I'm using this on stm32l4 and AT24C16 , there is a problem in multipage writing...it writes the intended content of the last page over all of the pages!!!
I need to check the c16 datasheet. Better Open the issue in the github.
I have exactly the same problem with writing in 24WC16P (16 bytes/128 pages). ALL data is recorded only on the first page. But in 24C64 (32 bytes/256 pages), the recording is performed correctly. And there is also a restriction on setting the byte offset in the page being written: writing does not occur if the offset exceeds the page size (in bytes). Apparently, it is necessary in the recording function to check for the offset output beyond the number of bytes in one page and make the appropriate correction?
According to the documentation for 24C16, the addressing of memory cells is different. The highest byte of the cell address is placed in the lowest tetrad of the device address byte (excluding bit '0'). I had to change the code and it worked correctly.
That’s perfect.
how to write & read variable (int,double) in eeprom?
haven't tested with that.. Will update once i do
Hi all! I add to write and read function "automatic calcul the page from offset" I hope it is correct.
page = offset / PAGE_SIZE;
offset = offset % PAGE_SIZE;
Have a nice day!
EEPROM is M24C04-R. I am trying to do write page and Read page of Structure values. But it's not reading after 16byte. So provide me solution for this.
As it's mentioned in the video, it targets the AT24 series from microchip..
Can't say about others..
Have you changed page settings? if not try these.
#define PAGE_SIZE 16
#define PAGE_NUM 32
Explanation:
Your EEPROM is 4kbit, in bytes that would be 4096bits/8bits = 512bytes. The datasheet says the page size is 16bytes. So, the number of pages would be 512bytes/16bytes = 32.
heeeeeyyy, veerryyy gooood. Thank youu verryy muuuch :)
how can i see the memory location of external memory module ?
What do you mean ? How do you want to see it exactly ?
I love your tutorials! Unless you revert back to the OOTB/Default CubeIDE color style I'll unfortunately have no choice but to pass on the upcoming tutorials. I simply can't see anything, its all black with some light tones of gray here and there man :(( Maybe your monitor settings are very high contrast, I don't know, but here on two computers its practically non-readable. Keep up the good work, thumbs up
Noted... I'll switch to light theme...
Actually never had that issue on any device i see the video on. But anyway there is no harm with light theme also
Haven't played with dark themes much to know but perhaps the font color can be brighten a bit, closer to white'ish. As-is and with those dark gray shades on black it definitely does not work for a general audience, need some seriously sharp eyesight *_* ;)
I try write and read using EEPROM AT24C256 and STM32F103C8 (Bluepill) but it's read just the first 6 adress the others give y(255)
This mostly is the issue from your end. Need to see your code. Ask in the telegram group or discord
EEPROM II SPI II STM32H743I please ...assume M95512(EEPROM)
it works great when i write on one page,but when i write in 2 or more seperate page it doesn't work properly unless i write and then exactly read the next line.i dont know where i'm making a mistake. EEPROM_Write(0, 0, (uint8_t *)dataW,strlen(dataW));
EEPROM_Write(3, 0, (uint8_t *)dataW2,strlen(dataW2));
EEPROM_Read(0, 0, dataRead, 15);
EEPROM_Read(3, 0, dataRead2, 15);
i use at24c08.
So it is working if you do the same but using write read write read... But not working with write write read read ?
@@ControllersTech yes it doesn't work when write write, read read
Ok I'll test it and get back..
It's working alright here. I tried With both the methods and results were same
@@ControllersTech tnx. maybe i made a mistake
perfect..!
can this be used in register level programming?
Sure. Instead of hal i2c mem write, use the function from my old video
@@ControllersTech can you send link of that video? And do we need to add same libraries also you mentioned in this video?
Look in the register programming playlist.. the i2c video
Yes you can use same libraries..
@@ControllersTech thanks. These have been very helpful
// function to determine the remaining bytes
uint16_t bytestowrite (uint16_t size, uint16_t offset)
{
if ((size+offset)
why what's wrong ?
if size is 30 and offset is 40 how is total data is 80?
Mention the time please.
@@ControllersTech8:48
Yes that seems like a mistake. Just assume that size is 40 and you are good to go.
Hi Sir, I am unable to understand RTOS please can u help me, how to write codes, about variables
There is a whole series on RTOS. Look in the playlist
bytestowrite is undefined