How to force I2C-NACK in slave receiver by using NBYTES?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-05-06 8:06 AM
Hi everyone,
I am using STM32G070 Nucleo board and work with I2C and use DMA to reload TXDR or read out RXDR. I built up a master that shall also be able to receive from other masters. Everything works fine so far. Now I want to limit the number of bytes clocked in by the other master and from reading the data sheet I assumed this is done by setting NBYTES to the desired value, making the peripheral send NACK when the number of bytes is reached. It works this way with master receiver and it works in a corresponding way with slave transmitter (there sending only FF after NBYTES are out). But it does not work with slave receiver. I still get all the bytes sent into my memory risking a buffer overflow.
Am I missing something?
Thanks for any help
Martin
- Labels:
-
I2C
-
STM32G0 Series
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-08-19 10:52 AM
dma will stop when full, it disables automatically and wont overflow memory. note that It will not consume any bytes from i2c rx reg then
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-09-05 2:16 PM
if you set number of bytes to NBYTES and enable TCR interrupt then you can inside the TCR call set NACK bit. Master should react to that by generating STOP. Then the slave is released.
I does work for me, but I use my own driver now. The HAL driver got stuck way too often.
