Skip to content

Commit

Permalink
Merge pull request #110 from mkbel/fix_drv_uvlo_read
Browse files Browse the repository at this point in the history
Fix drv uvlo read
  • Loading branch information
PavelSindler authored Feb 7, 2019
2 parents a959200 + 8cc1e53 commit e59d168
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
1 change: 1 addition & 0 deletions MM-control-01/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ void setup()
{
motion_set_idler(filament);
}
tmc2130_read_gstat(); //consume reset after power up

if (digitalRead(A1) == 1) isFilamentLoaded = true;

Expand Down
14 changes: 12 additions & 2 deletions MM-control-01/tmc2130.c
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,17 @@ uint8_t tmc2130_rx(uint8_t axis, uint8_t addr, uint32_t* rval)
return stat;
}

//! @brief Read global error flags for all axes
//! @brief Read global error flags for all axis
//!
//! Error is detected if any of following flags is set.
//! * reset
//! * IC has been reset since the last read access to GSTAT.
//! All registers have been cleared to reset values.
//! * drv_err
//! * Overtemperature or short circuit. Driver has been shut down.
//! * uv_cp
//! * Undervoltage on the charge pump. The driver is disabled in this case.
//!
//! @retval 0 no error
//! @retval >0 error, bit flag set for each axis
uint8_t tmc2130_read_gstat()
Expand All @@ -350,7 +360,7 @@ uint8_t tmc2130_read_gstat()
{
uint32_t result;
tmc2130_rd(axis, TMC2130_REG_GSTAT, &result);
if (result && 0x6) retval += (1 << axis);
if (result & 0x7) retval += (1 << axis);
}
return retval;
}

0 comments on commit e59d168

Please sign in to comment.