Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slower SPI speed for MAX31855 #3888

Merged
merged 1 commit into from
Jun 1, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Marlin/temperature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1138,10 +1138,12 @@ void Temperature::disable_all_heaters() {
uint32_t max6675_temp = 2000;
#define MAX6675_ERROR_MASK 7
#define MAX6675_DISCARD_BITS 18
#define MAX6675_SPEED_BITS (_BV(SPR1)) // clock ÷ 64
#else
uint16_t max6675_temp = 2000;
#define MAX6675_ERROR_MASK 4
#define MAX6675_DISCARD_BITS 3
#define MAX6675_SPEED_BITS (_BV(SPR0)) // clock ÷ 16
#endif

int Temperature::read_max6675() {
Expand All @@ -1161,7 +1163,7 @@ void Temperature::disable_all_heaters() {
PRR0
#endif
, PRSPI);
SPCR = _BV(MSTR) | _BV(SPE) | _BV(SPR0);
SPCR = _BV(MSTR) | _BV(SPE) | MAX6675_SPEED_BITS;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we sure the sd-library initialises SPCR for every use (read/write) or does it make sense to store it here and restore later

Copy link
Member Author

@thinkyhead thinkyhead May 26, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was wondering something similar. Would this be moved to the Temperature::init method (to only be initialized once)? Or… is there another approach you have in mind?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we don't yet know the answer to this, I will merge for now.


WRITE(MAX6675_SS, 0); // enable TT_MAX6675

Expand Down