nsaspook that was a great post. Let me reply this little by little
The master requests ADC, waits, then by setting SRQ HIGH we make sure there is no interruption and the slave does his thing. Then when finished puts SRQ LOW so that an interruption is generated in the master side.
Now, different than my idea, I understand what your interruption code does is only setting the spi_flag true to make the other code advance , is that right??
about your code, I catch the idea, but there are some things I dont understand, but I guess that is ok, since there are things I dont see.
For example what does HIGH and LOW means in terms of the delay function, why is it called in the transmit function (I understand why it is called in the ADCread function) and why interruptions are disabled and enabled in the delay function.
I also guess the channel is the number of the slave to which the order is directed and somehow when it enters the transmit function is transformed into the correct slave...
Anyway, thanks for the post. I ll give it a try with my own code this week and please help me if I find some difficulties.
I suppose these are the ones from the master?Top to bottom traces
SRQ Service request line from PIC18 to PIC32
SDI
SCK clocks for each transmission of a byte
SDO
I understood this procedure, and it was close to what I was thinking to do.The PIC32 input pin is configured to INT1 set to trigger on a negative edge sent from a output pin from the PIC18.
32 sends request for ADC data to 18 via SPI then waits for SRQ or timeouts out
18 sets the SRQ line HIGH when the ADC request is received and starts the conversion
18 completes the conversion (39.1 us), loads the ADC data into the SPI buffer then sets the SRQ line low
SRQ negative edge triggers the 32 ISR routine to set the spi_flag TRUE in the wait routine and it exits
32 then talks to the 18 slave to receive the data in the buffer (~10us from SRQ received)
The master requests ADC, waits, then by setting SRQ HIGH we make sure there is no interruption and the slave does his thing. Then when finished puts SRQ LOW so that an interruption is generated in the master side.
Now, different than my idea, I understand what your interruption code does is only setting the spi_flag true to make the other code advance , is that right??
about your code, I catch the idea, but there are some things I dont understand, but I guess that is ok, since there are things I dont see.
For example what does HIGH and LOW means in terms of the delay function, why is it called in the transmit function (I understand why it is called in the ADCread function) and why interruptions are disabled and enabled in the delay function.
I also guess the channel is the number of the slave to which the order is directed and somehow when it enters the transmit function is transformed into the correct slave...
Anyway, thanks for the post. I ll give it a try with my own code this week and please help me if I find some difficulties.