Hi! I just faced with fact that simavr was not designed to support direct connection of TWI IRQs of two AVRs lile next:
/* Connect i2c lines */
avr_connect_irq(
avr_io_getirq(board->master, AVR_IOCTL_TWI_GETIRQ(0), TWI_IRQ_OUTPUT),
avr_io_getirq(board->slave, AVR_IOCTL_TWI_GETIRQ(0), TWI_IRQ_INPUT));
avr_connect_irq(
avr_io_getirq(board->slave, AVR_IOCTL_TWI_GETIRQ(0), TWI_IRQ_OUTPUT),
avr_io_getirq(board->master, AVR_IOCTL_TWI_GETIRQ(0), TWI_IRQ_INPUT));
There two options:
- add extra code to simulation to connect directly AVRs: transform irq messages which are intended to peripheral to make them correctly handled by AVR;
- patch twi support in simavr to make it usable in multi-mk layouts.
Both approaches requires the good knowledge of simavr internals from me, but first requires it from others users requiters extra code and complicates the using of simavr lib. On the other hand the second approach may break api.
So my questions are next:
- am I right or I doing something wrong in my code?
- is there any working example for subject?
- which approach are preferred? If there no example for my situation, I'm going to patch simavr code and use it by myself (2nd approach) anyway. But if it has a chance to go to mainstream, I will spent time to check it with other examples and for bugs. I will create PR in any case.
Hi! I just faced with fact that simavr was not designed to support direct connection of TWI IRQs of two AVRs lile next:
There two options:
Both approaches requires the good knowledge of simavr internals from me, but first requires it from others users requiters extra code and complicates the using of simavr lib. On the other hand the second approach may break api.
So my questions are next: