SPI: Implemented MISO, MOSI, SCK and SS pins handling using avr_bitba…#249
SPI: Implemented MISO, MOSI, SCK and SS pins handling using avr_bitba…#249hovercraft-github wants to merge 1 commit intobuserror:masterfrom
Conversation
|
Does the 'old' mode works -- ie use one IRQ per words? As much as I like simulating more, I'm worried that bit banging will slow down simulation considerably.. Is there a way to make it 'optional'? I have simavr project where I'm not interested at all in the bit patterns generated, I'm more instered in what's passing on, and slowing down the simulation isn't terribly useful -- in fact that's why I never implemented it! :-) |
|
I tried to do all my best to preserve the 'old' mode. At least board_ssd1306 example works without any noticeable slow-down. Have you some additional tests or examples I can verify? |
|
Yes that would be great actually. An alternative would possibly be to be able to use a AVR_MCU macro and entirely disable the bitbang module? I suppose the module could be used to simulate modulation for the uart/i2c etc as well at that rate (eventually). The bitbang was never something I envisioned for simavr, as I'm more interested in the 'logical' simulation than in the pin-accurate simulation... |
|
@hovercraft-github any progress on this? I do like the idea of the AVR_MCU macro you add to your own firmware, kinda like the VCD, clock speed, voltages etc... |
|
Sorry, I was quite busy last month :) |
|
Sill quite keen on this patch @hovercraft-github -- no hurries but it'd be sad to drop it... |
|
@buserror Sorry, some circumstances prevented me from completing this task for several months. |
|
Hmm GH doesn't let me comment on the first commit somehow... so I'll paste this there: What about a static const char clock_div = { 4,16,64,128]; clock_divider = clock_div[clock_divider_ix) ? |
|
@buserror Majority of code complete, now testing. Thanks for the clock_divider note. |
|
It's looking good -- just tell me 'when' -- feel free to 'colapse' your commits if you feel like it.. |
|
I found discrepancy in how .name member of different peripherals initialized:
AVR_IOCTL_XX macros in examples and tests follow the same scheme, i.e. AVR_IOCTL_UART_GETIRQ('3') for uart3, but AVR_IOCTL_SPI_GETIRQ(0) for the standalone SPI. I still fill doubt on this however. |
|
It's possible that I didn't think of AVRS with multiple SPIs/TWI at the time I wrote the macro... I think I was planning all along to have it as a character tho... |
|
I believe it will become obvious how to deal with instance names when we start to implement SPI/USART. I want to ask you to leave it as is for awhile. |
|
@buserror Please review my last commit 2ec8a9a. I'm not sure you would like a new function avr_io_findinstance, but I find it very useful in any "generic" (i.e. not bound to some single processor model) Now all tests pass, board_timer_64led and board_ssd1306 examples pass, so I'm ready to 'squeeze' the commits.. Michel? |
|
I just did @hovercraft-github -- thanks for your work on this too... it's shaping up! :-) |
40f8003 to
dfc7fbe
Compare
|
@buserror I will try to add a variant of avr_io_findinstance according to your suggestion in separate patch later. |
|
@buserror Is there something stopping you from merging this patch now? Is it current avr_io_findinstance implementation? |
b1ef3af to
dfc7fbe
Compare
This allows to simulate a 'real' signal time patterns on SPI interface related MCU pins and communicate with diverse devices over it.
Should also fix #222.